Object.st
author Claus Gittinger <cg@exept.de>
Fri, 18 Aug 2006 16:23:48 +0200
changeset 9586 eb87399baea3
parent 9515 89c8275e009a
child 9635 270a1821e1c4
permissions -rw-r--r--
*** empty log message ***
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
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
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
6697
326f50b595f6 comment
Claus Gittinger <cg@exept.de>
parents: 6696
diff changeset
    16
	instanceVariableNames:''
326f50b595f6 comment
Claus Gittinger <cg@exept.de>
parents: 6696
diff changeset
    17
	classVariableNames:'ErrorSignal HaltSignal MessageNotUnderstoodSignal
326f50b595f6 comment
Claus Gittinger <cg@exept.de>
parents: 6696
diff changeset
    18
		UserInterruptSignal RecursionInterruptSignal
326f50b595f6 comment
Claus Gittinger <cg@exept.de>
parents: 6696
diff changeset
    19
		ExceptionInterruptSignal SubscriptOutOfBoundsSignal
326f50b595f6 comment
Claus Gittinger <cg@exept.de>
parents: 6696
diff changeset
    20
		IndexNotFoundSignal NonIntegerIndexSignal NotFoundSignal
326f50b595f6 comment
Claus Gittinger <cg@exept.de>
parents: 6696
diff changeset
    21
		KeyNotFoundSignal ElementOutOfBoundsSignal UserNotificationSignal
326f50b595f6 comment
Claus Gittinger <cg@exept.de>
parents: 6696
diff changeset
    22
		InformationSignal WarningSignal PrimitiveFailureSignal
326f50b595f6 comment
Claus Gittinger <cg@exept.de>
parents: 6696
diff changeset
    23
		DeepCopyErrorSignal AbortSignal ErrorRecursion Dependencies
326f50b595f6 comment
Claus Gittinger <cg@exept.de>
parents: 6696
diff changeset
    24
		InfoPrinting ActivityNotificationSignal InternalErrorSignal
326f50b595f6 comment
Claus Gittinger <cg@exept.de>
parents: 6696
diff changeset
    25
		NonWeakDependencies SynchronizationSemaphores ObjectAttributes
326f50b595f6 comment
Claus Gittinger <cg@exept.de>
parents: 6696
diff changeset
    26
		OSSignalInterruptSignal FinalizationLobby
326f50b595f6 comment
Claus Gittinger <cg@exept.de>
parents: 6696
diff changeset
    27
		RecursiveStoreStringSignal AbortAllSignal'
326f50b595f6 comment
Claus Gittinger <cg@exept.de>
parents: 6696
diff changeset
    28
	poolDictionaries:''
326f50b595f6 comment
Claus Gittinger <cg@exept.de>
parents: 6696
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
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
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
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   121
        ErrorSignal     <Signal>        Signal raised for error/error: messages
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   122
                                        also, parent of all other signals.
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   123
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   124
        HaltSignal      <Signal>        Signal raised for halt/halt: messages
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   125
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   126
        MessageNotUnderstoodSignal      Signals raised for various error conditions
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   127
        UserInterruptSignal
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   128
        RecursionInterruptSignal 
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   129
        ExceptionInterruptSignal
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   130
        SubscriptOutOfBoundsSignal 
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   131
        NonIntegerIndexSignal
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   132
        NotFoundSignal 
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   133
        KeyNotFoundSignal 
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   134
        ElementOutOfBoundsSignal
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   135
        InformationSignal
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   136
        WarningSignal
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   137
        DeepCopyErrorSignal
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   138
        InternalErrorSignal
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   139
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   140
        AbortSignal      <Signal>       Signal raised by debugger, to abort a computation
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   141
                                        BUT, the debugger will only raise it if it is handled.
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   142
                                        By handling the abortSignal, you can control where the
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   143
                                        debuggers abort-function resumes execution in case of
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   144
                                        an error.
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   145
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   146
        ErrorRecursion   <Boolean>      controls behavior when recursive errors occur (i.e. 
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   147
                                        an error while handling an error).
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   148
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   149
        Dependencies     <WeakDependencyDictionary>  
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   150
                                        keeps track of object dependencies.
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   151
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   152
        InfoPrinting     <Boolean>      controls weather informational messages 
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   153
                                        are printed.
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   154
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   155
        ActivityNotificationSignal <QuerySignal> 
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   156
                                         raised on #activityNotification:
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   157
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   158
        NonWeakDependencies <Dictionary> keeps track of object dependencies.
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   159
                                         Dependents stay alive.
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   160
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   161
        SynchronizationSemaphores <WeakIdentityDictionary>
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
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:]
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
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 := HaltInterrupt.
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   181
    HaltSignal notifierString:'halt encountered'.
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   182
5977
1aa80a42ed64 more class based exceptions
Claus Gittinger <cg@exept.de>
parents: 5971
diff changeset
   183
    MessageNotUnderstoodSignal := MessageNotUnderstood.
5971
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   184
    MessageNotUnderstoodSignal notifierString:'message not understood'.
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   185
6000
d6fbafc5879e more class based exceptions
Claus Gittinger <cg@exept.de>
parents: 5995
diff changeset
   186
    PrimitiveFailureSignal := PrimitiveFailure.
5971
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   187
    PrimitiveFailureSignal notifierString:'primitive failed'.
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   188
8330
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
   189
    InternalErrorSignal := VMInternalError.
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
   190
5971
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   191
    UserInterruptSignal := UserInterrupt.
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   192
    UserInterruptSignal notifierString:'user Interrupt'.
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   193
6146
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   194
    RecursionInterruptSignal := RecursionError.
5971
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   195
    RecursionInterruptSignal notifierString:'recursion limit reached'.
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   196
5977
1aa80a42ed64 more class based exceptions
Claus Gittinger <cg@exept.de>
parents: 5971
diff changeset
   197
    NotFoundSignal := NotFoundError.
5971
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   198
    NotFoundSignal notifierString:'no such element'.
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   199
5977
1aa80a42ed64 more class based exceptions
Claus Gittinger <cg@exept.de>
parents: 5971
diff changeset
   200
    IndexNotFoundSignal := IndexNotFoundError.
5971
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   201
    IndexNotFoundSignal notifierString:'bad index: '.
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   202
5977
1aa80a42ed64 more class based exceptions
Claus Gittinger <cg@exept.de>
parents: 5971
diff changeset
   203
    SubscriptOutOfBoundsSignal := SubscriptOutOfBoundsError.
5971
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   204
    SubscriptOutOfBoundsSignal notifierString:'subscript out of bounds: '.
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   205
5977
1aa80a42ed64 more class based exceptions
Claus Gittinger <cg@exept.de>
parents: 5971
diff changeset
   206
    NonIntegerIndexSignal := NonIntegerIndexError.
1aa80a42ed64 more class based exceptions
Claus Gittinger <cg@exept.de>
parents: 5971
diff changeset
   207
    NonIntegerIndexSignal notifierString:'index must be integer'.
1aa80a42ed64 more class based exceptions
Claus Gittinger <cg@exept.de>
parents: 5971
diff changeset
   208
8330
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
   209
    KeyNotFoundSignal := KeyNotFoundError.
5977
1aa80a42ed64 more class based exceptions
Claus Gittinger <cg@exept.de>
parents: 5971
diff changeset
   210
    KeyNotFoundSignal notifierString:'no such key: '.
1aa80a42ed64 more class based exceptions
Claus Gittinger <cg@exept.de>
parents: 5971
diff changeset
   211
8330
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
   212
    ElementOutOfBoundsSignal := ElementBoundsError.
5971
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   213
7033
c4183ea85a71 Now Warning is a subclass of UserNotification.
Stefan Vogel <sv@exept.de>
parents: 7031
diff changeset
   214
    UserNotificationSignal := UserNotification.
c4183ea85a71 Now Warning is a subclass of UserNotification.
Stefan Vogel <sv@exept.de>
parents: 7031
diff changeset
   215
    WarningSignal := Warning.
7035
1d049fb7ae5a Make UserInformation a class based exception
Stefan Vogel <sv@exept.de>
parents: 7033
diff changeset
   216
    InformationSignal := UserInformation.
8330
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
   217
    ActivityNotificationSignal := ActivityNotification.
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
   218
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
   219
    DeepCopyErrorSignal := DeepCopyError.
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
   220
6203
d39d75849383 class based exceptions - abortSignal
Claus Gittinger <cg@exept.de>
parents: 6199
diff changeset
   221
    AbortSignal := AbortOperationRequest.
6877
ab4e7d42f9f8 AbortAllOperation - now class based
Claus Gittinger <cg@exept.de>
parents: 6874
diff changeset
   222
    AbortAllSignal := AbortAllOperationRequest.
8330
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
   223
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
   224
    OSSignalInterruptSignal := OSSignalInterrupt.
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
   225
    RecursiveStoreStringSignal := RecursiveStoreError.
5971
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   226
5980
5fd29de6d596 more class based exceptions
Claus Gittinger <cg@exept.de>
parents: 5977
diff changeset
   227
    "
5fd29de6d596 more class based exceptions
Claus Gittinger <cg@exept.de>
parents: 5977
diff changeset
   228
     Object initSignals
5fd29de6d596 more class based exceptions
Claus Gittinger <cg@exept.de>
parents: 5977
diff changeset
   229
    "
5971
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   230
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   231
    "Modified: / 22.1.1998 / 21:23:40 / av"
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   232
    "Modified: / 4.8.1999 / 08:54:06 / stefan"
6203
d39d75849383 class based exceptions - abortSignal
Claus Gittinger <cg@exept.de>
parents: 6199
diff changeset
   233
    "Modified: / 16.11.2001 / 16:30:08 / cg"
5971
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   234
!
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   235
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   236
initialize
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   237
    "called only once - initialize signals"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   238
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   239
    ErrorSignal isNil ifTrue:[
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   240
        self initSignals
5971
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   241
    ].
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
    ObjectAttributes isNil ifTrue:[
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   244
        ObjectAttributes := WeakIdentityDictionary new.
5971
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   245
    ].
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   246
    Dependencies isNil ifTrue:[
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   247
        Dependencies := WeakDependencyDictionary new.
5971
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   248
    ].
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   249
    NonWeakDependencies isNil ifTrue:[
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   250
        NonWeakDependencies := IdentityDictionary new.
5971
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   251
    ].
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   252
    SynchronizationSemaphores isNil ifTrue:[
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   253
        SynchronizationSemaphores := WeakIdentityDictionary new.
5971
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   254
    ].
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   255
    FinalizationLobby isNil ifTrue:[
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   256
        FinalizationLobby := Registry new.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   257
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   258
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   259
    "/ initialize InfoPrinting to the VM's infoPrint setting
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   260
    "/ (which can be turned off via a command line argument)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   261
    InfoPrinting := ObjectMemory infoPrinting.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   262
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   263
    "Object initialize"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   264
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   265
    "Modified: / 22.1.1998 / 21:23:40 / av"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   266
    "Modified: / 3.2.1998 / 18:55:09 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   267
    "Modified: / 4.8.1999 / 08:54:06 / stefan"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   268
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   269
7303
98111fb6a285 category
Claus Gittinger <cg@exept.de>
parents: 7285
diff changeset
   270
!Object class methodsFor:'Compatibility-ST80'!
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   271
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   272
rootError
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   273
    "return the signal used for error/error: - handling.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   274
     Same as errorSignal for ST80 compatibility."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   275
7094
617eeaf2f8ba Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7081
diff changeset
   276
    ^ Error
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   277
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   278
    "Created: / 15.1.1998 / 23:47:05 / stefan"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   279
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   280
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   281
!Object class methodsFor:'Signal constants'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   282
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   283
abortAllSignal 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   284
    "return the signal used to abort user actions (much like AbortSignal).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   285
     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
   286
     the loop (such as when confirming multiple class deletions etc.)"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   287
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   288
    ^ AbortAllSignal
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   289
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   290
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   291
abortSignal 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   292
    "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
   293
     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
   294
     currently active doIt/printIt or inspectIt. (also some others use
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   295
     this for a save abort)"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   296
8521
60f0e479ffc1 use class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8502
diff changeset
   297
    ^ AbortOperationRequest
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   298
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   299
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   300
activityNotificationSignal
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   301
    "return the signal used for activity notifications.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   302
     A handler for this signal gets all #activityNotification: sends"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   303
8330
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
   304
    ^ ActivityNotification
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   305
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   306
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   307
deepCopyErrorSignal 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   308
    "return the signal raised when a deepcopy is asked for
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   309
     an object which cannot do this (for example, BlockClosures
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   310
     or Contexts)."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   311
8330
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
   312
    ^ DeepCopyError
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   313
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   314
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   315
elementOutOfBoundsSignal
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   316
    "return the signal used for element error reporting
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   317
     (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
   318
      be put into a bytearray)"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   319
8330
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
   320
    ^ ElementBoundsError
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   321
!
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
errorSignal
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   324
    "return the signal used for error/error: - handling"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   325
7094
617eeaf2f8ba Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7081
diff changeset
   326
    ^ Error
5755
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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   329
haltSignal
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   330
    "return the signal used for halt/halt: - handling"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   331
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   332
    ^ HaltSignal
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
indexNotFoundSignal
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   336
    "return the signal used for bad index error reporting.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   337
     This is also the parentSignal of the nonIntegerIndex- and
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   338
     subscriptOutOfBoundsSignal"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   339
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   340
    ^ IndexNotFoundSignal
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   341
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   342
    "Created: / 8.11.1997 / 19:15:48 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   343
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   344
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   345
informationSignal 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   346
    "return the signal used for informations. 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   347
     A handler for this signal gets all #information: sends"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   348
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   349
    ^ InformationSignal
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   350
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   351
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   352
internalErrorSignal
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   353
    "return the signal used to report internal (VM-) errors."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   354
8330
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
   355
    ^ VMInternalError
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   356
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   357
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   358
keyNotFoundSignal 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   359
    "return the signal used for no such key error reporting"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   360
8330
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
   361
    ^ KeyNotFoundError
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   362
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   363
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   364
messageNotUnderstoodSignal
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   365
    "return the signal used for doesNotUnderstand: - error handling"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   366
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   367
    ^ MessageNotUnderstoodSignal
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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   370
nonIntegerIndexSignal 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   371
    "return the signal used for bad subscript error reporting"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   372
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   373
    ^ NonIntegerIndexSignal
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   374
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   375
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   376
notFoundSignal 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   377
    "return the signal used for no element found error reporting"
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
    ^ NotFoundSignal
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   380
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   381
7644
211762a9a39f added notifySignal for VW compatibility
Claus Gittinger <cg@exept.de>
parents: 7621
diff changeset
   382
notifySignal
211762a9a39f added notifySignal for VW compatibility
Claus Gittinger <cg@exept.de>
parents: 7621
diff changeset
   383
    "return the parent of all notification signals."
211762a9a39f added notifySignal for VW compatibility
Claus Gittinger <cg@exept.de>
parents: 7621
diff changeset
   384
211762a9a39f added notifySignal for VW compatibility
Claus Gittinger <cg@exept.de>
parents: 7621
diff changeset
   385
    ^ Notification
211762a9a39f added notifySignal for VW compatibility
Claus Gittinger <cg@exept.de>
parents: 7621
diff changeset
   386
!
211762a9a39f added notifySignal for VW compatibility
Claus Gittinger <cg@exept.de>
parents: 7621
diff changeset
   387
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   388
osSignalInterruptSignal 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   389
    "return the signal used for OS-signal error reporting;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   390
     This is only raised if handled - otherwise, a debugger is entered."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   391
8330
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
   392
    ^ OSSignalInterrupt
5755
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
    "Modified: / 12.6.1998 / 16:27:26 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   395
!
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
primitiveFailureSignal
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   398
    "return the signal used for primitiveFailed - error handling"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   399
8330
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
   400
    ^ PrimitiveFailure
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   401
!
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
privateMethodSignal
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   404
    "return the signal used for privateMethod - error handling"
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
    ^ MessageNotUnderstoodSignal
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   407
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   408
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   409
recursionInterruptSignal 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   410
    "return the signal used for recursion overflow error handling"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   411
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   412
    ^ RecursionInterruptSignal
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   413
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   414
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   415
recursiveStoreStringSignal
8330
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
   416
    "return the notification used to report storeString generation of recursive objects"
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
   417
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
   418
    ^ RecursiveStoreError
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
   419
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
   420
    "
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
   421
     RecursiveStoreError handle:[:ex |
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   422
        self halt
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   423
     ] do:[
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   424
        |a|
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   425
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   426
        a := Array new:1.
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   427
        a at:1 put:a.
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   428
        a storeOn:Transcript
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   429
     ]
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   430
    "
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
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   433
     |a|
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
     a := Array new:1.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   436
     a at:1 put:a.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   437
     a storeOn:Transcript
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   438
    "
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
5980
5fd29de6d596 more class based exceptions
Claus Gittinger <cg@exept.de>
parents: 5977
diff changeset
   441
subclassResponsibilitySignal
5fd29de6d596 more class based exceptions
Claus Gittinger <cg@exept.de>
parents: 5977
diff changeset
   442
    "return the signal used for subclassResponsibility error reporting.
6652
4cfba8cb0652 typo and undo renaming of #/#cons:
Stefan Vogel <sv@exept.de>
parents: 6647
diff changeset
   443
     (this signal is used to signal incomplete subclasses - i.e. a programmers error)"
5980
5fd29de6d596 more class based exceptions
Claus Gittinger <cg@exept.de>
parents: 5977
diff changeset
   444
5fd29de6d596 more class based exceptions
Claus Gittinger <cg@exept.de>
parents: 5977
diff changeset
   445
    ^ SubclassResponsibilityError
5fd29de6d596 more class based exceptions
Claus Gittinger <cg@exept.de>
parents: 5977
diff changeset
   446
!
5fd29de6d596 more class based exceptions
Claus Gittinger <cg@exept.de>
parents: 5977
diff changeset
   447
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   448
subscriptOutOfBoundsSignal
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   449
    "return the signal used for subscript error reporting.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   450
     (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
   451
      index less than 1 or greater than the array size)"
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
    ^ SubscriptOutOfBoundsSignal
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   454
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   455
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   456
userInterruptSignal
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   457
    "return the signal used for ^C interrupts handling"
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
    ^ UserInterruptSignal
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
userNotificationSignal
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   463
    "the parent signal used with information and warnings.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   464
     Handling this allows handling of both information- and warning notifications."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   465
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   466
    ^ UserNotificationSignal
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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   469
warningSignal 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   470
    "return the signal used for warnings.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   471
     A handler for this signal gets all #warn: sends"
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
    ^ WarningSignal
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   474
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   475
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   476
!Object class methodsFor:'info messages'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   477
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   478
infoPrinting
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   479
    "return the flag which controls information messages."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   480
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   481
    ^ InfoPrinting
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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   484
infoPrinting:aBoolean
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   485
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   486
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   487
    "turn on/off printing of information messages.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   488
     If the argument, aBoolean is false, infoPrint will not output
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   489
     messages. The default is true."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   490
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   491
    InfoPrinting := aBoolean
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   492
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   493
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   494
!Object class methodsFor:'queries'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   495
8892
5d05a7f150a5 +isAbstract
Claus Gittinger <cg@exept.de>
parents: 8879
diff changeset
   496
isAbstract
5d05a7f150a5 +isAbstract
Claus Gittinger <cg@exept.de>
parents: 8879
diff changeset
   497
    ^ self == Object
5d05a7f150a5 +isAbstract
Claus Gittinger <cg@exept.de>
parents: 8879
diff changeset
   498
!
5d05a7f150a5 +isAbstract
Claus Gittinger <cg@exept.de>
parents: 8879
diff changeset
   499
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   500
isBuiltInClass
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   501
    "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
   502
     i.e. you cannot add/remove instance variables without recompiling
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   503
     the VM.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   504
     Here, true is returned for myself, false for subclasses."
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
    ^ self == Object
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
    "Modified: 23.4.1996 / 16:00:07 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   509
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   510
8441
728c887f2532 Dolphin compatibility: #trigger...
Stefan Vogel <sv@exept.de>
parents: 8426
diff changeset
   511
!Object methodsFor:'Compatibility-Dolphin'!
728c887f2532 Dolphin compatibility: #trigger...
Stefan Vogel <sv@exept.de>
parents: 8426
diff changeset
   512
728c887f2532 Dolphin compatibility: #trigger...
Stefan Vogel <sv@exept.de>
parents: 8426
diff changeset
   513
trigger:anAspect 
728c887f2532 Dolphin compatibility: #trigger...
Stefan Vogel <sv@exept.de>
parents: 8426
diff changeset
   514
    self changed:anAspect
728c887f2532 Dolphin compatibility: #trigger...
Stefan Vogel <sv@exept.de>
parents: 8426
diff changeset
   515
!
728c887f2532 Dolphin compatibility: #trigger...
Stefan Vogel <sv@exept.de>
parents: 8426
diff changeset
   516
728c887f2532 Dolphin compatibility: #trigger...
Stefan Vogel <sv@exept.de>
parents: 8426
diff changeset
   517
trigger:anAspect with:anArgument 
728c887f2532 Dolphin compatibility: #trigger...
Stefan Vogel <sv@exept.de>
parents: 8426
diff changeset
   518
    self changed:anAspect with:anArgument
728c887f2532 Dolphin compatibility: #trigger...
Stefan Vogel <sv@exept.de>
parents: 8426
diff changeset
   519
!
728c887f2532 Dolphin compatibility: #trigger...
Stefan Vogel <sv@exept.de>
parents: 8426
diff changeset
   520
728c887f2532 Dolphin compatibility: #trigger...
Stefan Vogel <sv@exept.de>
parents: 8426
diff changeset
   521
when:anAspect sendTo:anObject
728c887f2532 Dolphin compatibility: #trigger...
Stefan Vogel <sv@exept.de>
parents: 8426
diff changeset
   522
    self expressInterestIn:anAspect for:anObject sendBack:anAspect
728c887f2532 Dolphin compatibility: #trigger...
Stefan Vogel <sv@exept.de>
parents: 8426
diff changeset
   523
! !
728c887f2532 Dolphin compatibility: #trigger...
Stefan Vogel <sv@exept.de>
parents: 8426
diff changeset
   524
9375
6cbc697095e7 Felix 6/15/2006
fm
parents: 9335
diff changeset
   525
!Object methodsFor:'Compatibility-ST/V'!
6cbc697095e7 Felix 6/15/2006
fm
parents: 9335
diff changeset
   526
6cbc697095e7 Felix 6/15/2006
fm
parents: 9335
diff changeset
   527
triggerEvent:aSymbol
6cbc697095e7 Felix 6/15/2006
fm
parents: 9335
diff changeset
   528
    self changed:aSymbol
6cbc697095e7 Felix 6/15/2006
fm
parents: 9335
diff changeset
   529
! !
6cbc697095e7 Felix 6/15/2006
fm
parents: 9335
diff changeset
   530
7261
f35fc9cee675 method category rename
Claus Gittinger <cg@exept.de>
parents: 7216
diff changeset
   531
!Object methodsFor:'Compatibility-ST80'!
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   532
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   533
isMetaclass
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   534
    ^ self isMeta
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
7261
f35fc9cee675 method category rename
Claus Gittinger <cg@exept.de>
parents: 7216
diff changeset
   537
!Object methodsFor:'Compatibility-Squeak'!
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   538
6549
8664491c4428 #as: returns the receiver if its class already matches
Claus Gittinger <cg@exept.de>
parents: 6537
diff changeset
   539
as:aSimilarClass
8664491c4428 #as: returns the receiver if its class already matches
Claus Gittinger <cg@exept.de>
parents: 6537
diff changeset
   540
    "If the receivers class is not aSimilarClass,
8664491c4428 #as: returns the receiver if its class already matches
Claus Gittinger <cg@exept.de>
parents: 6537
diff changeset
   541
     create and return an object of class aSimilarClass that has the same contents 
8664491c4428 #as: returns the receiver if its class already matches
Claus Gittinger <cg@exept.de>
parents: 6537
diff changeset
   542
     as the receiver.
8664491c4428 #as: returns the receiver if its class already matches
Claus Gittinger <cg@exept.de>
parents: 6537
diff changeset
   543
     Otherwise, return the receiver."
8664491c4428 #as: returns the receiver if its class already matches
Claus Gittinger <cg@exept.de>
parents: 6537
diff changeset
   544
8664491c4428 #as: returns the receiver if its class already matches
Claus Gittinger <cg@exept.de>
parents: 6537
diff changeset
   545
    self class == aSimilarClass ifTrue:[^ self].
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   546
    ^ aSimilarClass newFrom:self
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   547
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
     #[1 2 3 4] as:ByteArray
6549
8664491c4428 #as: returns the receiver if its class already matches
Claus Gittinger <cg@exept.de>
parents: 6537
diff changeset
   550
     #[1 2 3 4] as:Array
5755
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
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   553
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   554
asString
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   555
    ^ self printString
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   556
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   557
9071
e7d44f6f017a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9005
diff changeset
   558
becomeForward:anotherObject
e7d44f6f017a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9005
diff changeset
   559
    self becomeSameAs:anotherObject
e7d44f6f017a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9005
diff changeset
   560
!
e7d44f6f017a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9005
diff changeset
   561
e7d44f6f017a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9005
diff changeset
   562
becomeForward:anotherObject copyHash:copyHash
e7d44f6f017a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9005
diff changeset
   563
    copyHash ifTrue:[ self error:'unsupported operation' ].
e7d44f6f017a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9005
diff changeset
   564
    self becomeSameAs:anotherObject
e7d44f6f017a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9005
diff changeset
   565
!
e7d44f6f017a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9005
diff changeset
   566
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   567
clone
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   568
    ^ self shallowCopy
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
6146
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   571
copyTwoLevel
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   572
    "one more level than a shallowCopy"
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   573
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   574
    ^ self copyToLevel:2
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   575
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   576
    "
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   577
     |original copy elL1 elL2 elL3 copyOfElL1|
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   578
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   579
     original := Array new:3.
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   580
     original at:1 put:1234.
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   581
     original at:2 put:'hello'.
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   582
     original at:3 put:(elL1 := Array new:3).
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   583
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   584
     elL1 at:1 put:1234.
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   585
     elL1 at:2 put:'hello'.
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   586
     elL1 at:3 put:(elL2 := Array new:3).
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   587
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   588
     elL2 at:1 put:1234.
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   589
     elL2 at:2 put:'hello'.
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   590
     elL2 at:3 put:(elL3 := Array new:3).
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   591
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   592
     elL3 at:1 put:1234.
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   593
     elL3 at:2 put:'hello'.
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   594
     elL3 at:3 put:(Array new:3).
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   595
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   596
     copy := original copyTwoLevel.
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   597
     (original at:2) ~~ (copy at:2) ifFalse:[self halt].
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   598
     (original at:3) ~~ (copy at:3) ifFalse:[self halt].
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   599
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   600
     copyOfElL1 := copy at:3.
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   601
     (elL1 at:2) == (copyOfElL1 at:2) ifFalse:[self halt].
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   602
     (elL1 at:3) == (copyOfElL1 at:3) ifFalse:[self halt].
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   603
    "
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   604
!
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   605
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   606
currentHand
5912
8e3d9ac02b3b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5893
diff changeset
   607
    "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
   608
8e3d9ac02b3b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5893
diff changeset
   609
    |w h|
8e3d9ac02b3b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5893
diff changeset
   610
8e3d9ac02b3b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5893
diff changeset
   611
    w := self currentWorld.
8e3d9ac02b3b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5893
diff changeset
   612
    h := w activeHand.
8e3d9ac02b3b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5893
diff changeset
   613
    h isNil ifTrue:[
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   614
        h := w hands first
5912
8e3d9ac02b3b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5893
diff changeset
   615
    ].
8e3d9ac02b3b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5893
diff changeset
   616
    ^ h
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   617
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   618
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   619
currentWorld
7159
7964c345d74c Object currentWorld - recursion if Utilities is unloaded
Claus Gittinger <cg@exept.de>
parents: 7121
diff changeset
   620
    Utilities autoload.    
7964c345d74c Object currentWorld - recursion if Utilities is unloaded
Claus Gittinger <cg@exept.de>
parents: 7121
diff changeset
   621
    ^ Utilities currentWorld
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   622
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   623
7320
0d5b4de4045a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7303
diff changeset
   624
explore
0d5b4de4045a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7303
diff changeset
   625
    (self confirm:'The Squeak explorer has not yet been ported to ST/X\\Inspect instead ?' withCRs)
0d5b4de4045a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7303
diff changeset
   626
    ifTrue:[
0d5b4de4045a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7303
diff changeset
   627
        self inspect
0d5b4de4045a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7303
diff changeset
   628
    ]
0d5b4de4045a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7303
diff changeset
   629
!
0d5b4de4045a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7303
diff changeset
   630
9335
2dcbf8f91693 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9314
diff changeset
   631
isInMemory
2dcbf8f91693 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9314
diff changeset
   632
    "All normal objects are."
2dcbf8f91693 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9314
diff changeset
   633
2dcbf8f91693 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9314
diff changeset
   634
    ^ true
2dcbf8f91693 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9314
diff changeset
   635
!
2dcbf8f91693 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9314
diff changeset
   636
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   637
newTileMorphRepresentative
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   638
        ^ TileMorph new setLiteral: self
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   639
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   640
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   641
stringForReadout
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   642
        ^ self stringRepresentation
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   643
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   644
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   645
stringRepresentation
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   646
        "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"
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   647
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   648
        ^ self printString 
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   649
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   650
9146
56176a7bf685 +valueWithPossibleArguments:
Claus Gittinger <cg@exept.de>
parents: 9105
diff changeset
   651
valueWithPossibleArguments:argArray
56176a7bf685 +valueWithPossibleArguments:
Claus Gittinger <cg@exept.de>
parents: 9105
diff changeset
   652
     ^ self
56176a7bf685 +valueWithPossibleArguments:
Claus Gittinger <cg@exept.de>
parents: 9105
diff changeset
   653
!
56176a7bf685 +valueWithPossibleArguments:
Claus Gittinger <cg@exept.de>
parents: 9105
diff changeset
   654
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   655
veryDeepCopy
8383
dea5311899c5 comments in copy methods
Claus Gittinger <cg@exept.de>
parents: 8377
diff changeset
   656
     ^ self deepCopyUsing:(IdentityDictionary new)
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   657
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   658
7567
1c1a49b3ebf0 compatibility
Claus Gittinger <cg@exept.de>
parents: 7566
diff changeset
   659
!Object methodsFor:'Compatibility-VW'!
1c1a49b3ebf0 compatibility
Claus Gittinger <cg@exept.de>
parents: 7566
diff changeset
   660
8637
e7e695f53819 *** empty log message ***
penk
parents: 8632
diff changeset
   661
isCharacters
e7e695f53819 *** empty log message ***
penk
parents: 8632
diff changeset
   662
    "added for visual works compatibility"
e7e695f53819 *** empty log message ***
penk
parents: 8632
diff changeset
   663
    ^ false
e7e695f53819 *** empty log message ***
penk
parents: 8632
diff changeset
   664
!
e7e695f53819 *** empty log message ***
penk
parents: 8632
diff changeset
   665
7567
1c1a49b3ebf0 compatibility
Claus Gittinger <cg@exept.de>
parents: 7566
diff changeset
   666
keyNotFoundError:aKey
1c1a49b3ebf0 compatibility
Claus Gittinger <cg@exept.de>
parents: 7566
diff changeset
   667
    "VW compatibility"
1c1a49b3ebf0 compatibility
Claus Gittinger <cg@exept.de>
parents: 7566
diff changeset
   668
1c1a49b3ebf0 compatibility
Claus Gittinger <cg@exept.de>
parents: 7566
diff changeset
   669
    self errorKeyNotFound:aKey.
1c1a49b3ebf0 compatibility
Claus Gittinger <cg@exept.de>
parents: 7566
diff changeset
   670
!
1c1a49b3ebf0 compatibility
Claus Gittinger <cg@exept.de>
parents: 7566
diff changeset
   671
1c1a49b3ebf0 compatibility
Claus Gittinger <cg@exept.de>
parents: 7566
diff changeset
   672
oneWayBecome:anotherObject
1c1a49b3ebf0 compatibility
Claus Gittinger <cg@exept.de>
parents: 7566
diff changeset
   673
    ^ self becomeSameAs:anotherObject
1c1a49b3ebf0 compatibility
Claus Gittinger <cg@exept.de>
parents: 7566
diff changeset
   674
1c1a49b3ebf0 compatibility
Claus Gittinger <cg@exept.de>
parents: 7566
diff changeset
   675
    "
1c1a49b3ebf0 compatibility
Claus Gittinger <cg@exept.de>
parents: 7566
diff changeset
   676
     |arr o1 o2|
1c1a49b3ebf0 compatibility
Claus Gittinger <cg@exept.de>
parents: 7566
diff changeset
   677
1c1a49b3ebf0 compatibility
Claus Gittinger <cg@exept.de>
parents: 7566
diff changeset
   678
     arr := Array new:2.
1c1a49b3ebf0 compatibility
Claus Gittinger <cg@exept.de>
parents: 7566
diff changeset
   679
     arr at:1 put:(o1 := Object new).
1c1a49b3ebf0 compatibility
Claus Gittinger <cg@exept.de>
parents: 7566
diff changeset
   680
     arr at:2 put:(o2 := Point new).
1c1a49b3ebf0 compatibility
Claus Gittinger <cg@exept.de>
parents: 7566
diff changeset
   681
     o1 oneWayBecome:o2.
1c1a49b3ebf0 compatibility
Claus Gittinger <cg@exept.de>
parents: 7566
diff changeset
   682
     (arr at:1) ~~ o2 ifTrue:[self halt].
1c1a49b3ebf0 compatibility
Claus Gittinger <cg@exept.de>
parents: 7566
diff changeset
   683
    "
1c1a49b3ebf0 compatibility
Claus Gittinger <cg@exept.de>
parents: 7566
diff changeset
   684
    "
1c1a49b3ebf0 compatibility
Claus Gittinger <cg@exept.de>
parents: 7566
diff changeset
   685
     |arr o1 o2|
1c1a49b3ebf0 compatibility
Claus Gittinger <cg@exept.de>
parents: 7566
diff changeset
   686
1c1a49b3ebf0 compatibility
Claus Gittinger <cg@exept.de>
parents: 7566
diff changeset
   687
     arr := Array new:2.
1c1a49b3ebf0 compatibility
Claus Gittinger <cg@exept.de>
parents: 7566
diff changeset
   688
     arr at:1 put:(o1 := Object new).
1c1a49b3ebf0 compatibility
Claus Gittinger <cg@exept.de>
parents: 7566
diff changeset
   689
     arr at:2 put:(o2 := Point new).
1c1a49b3ebf0 compatibility
Claus Gittinger <cg@exept.de>
parents: 7566
diff changeset
   690
     o1 becomeSameAs:o2.
1c1a49b3ebf0 compatibility
Claus Gittinger <cg@exept.de>
parents: 7566
diff changeset
   691
     (arr at:1) ~~ o2 ifTrue:[self halt].
1c1a49b3ebf0 compatibility
Claus Gittinger <cg@exept.de>
parents: 7566
diff changeset
   692
    "
1c1a49b3ebf0 compatibility
Claus Gittinger <cg@exept.de>
parents: 7566
diff changeset
   693
! !
1c1a49b3ebf0 compatibility
Claus Gittinger <cg@exept.de>
parents: 7566
diff changeset
   694
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   695
!Object methodsFor:'accessing'!
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
at:index
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   698
    "return the indexed instance variable with index, anInteger;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   699
     this method can be redefined in subclasses."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   700
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   701
    ^ self basicAt:index
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   702
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   703
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   704
at:index put:anObject
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   705
    "store the 2nd arg, anObject as indexed instvar with index, anInteger.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   706
     this method can be redefined in subclasses. Returns anObject (sigh)"
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
    ^ self basicAt:index put:anObject
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   709
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   710
    "Modified: 19.4.1996 / 11:13:29 / cg"
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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   713
basicAt:index
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   714
    "return the indexed instance variable with index, anInteger.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   715
     Trigger an error if the receiver has no indexed instance variables.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   716
     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
   717
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   718
%{  /* NOCONTEXT */
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   719
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   720
    REGISTER int nbytes, indx;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   721
    OBJ myClass;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   722
    REGISTER char *pFirst;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   723
    REGISTER int n;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   724
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   725
    /*
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   726
     * notice the missing test for self being a nonNilObject -
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   727
     * this can be done since basicAt: is defined both in UndefinedObject
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   728
     * and SmallInteger
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   729
     */
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   730
    if (__isSmallInteger(index)) {
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   731
        myClass = __qClass(self);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   732
        indx = __intVal(index) - 1;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   733
        n /* nInstVars */ = __intVal(__ClassInstPtr(myClass)->c_ninstvars);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   734
        n /* nInstBytes */ = OHDR_SIZE + __OBJS2BYTES__(n /* nInstVars */);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   735
        nbytes = __qSize(self) - n /* nInstBytes */;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   736
        pFirst = (char *)(__InstPtr(self)) + n /* nInstBytes */;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   737
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   738
        switch ((INT)(__ClassInstPtr(myClass)->c_flags) & __MASKSMALLINT(ARRAYMASK)) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   739
            case __MASKSMALLINT(POINTERARRAY):
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   740
            case __MASKSMALLINT(WKPOINTERARRAY):
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   741
                /*
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   742
                 * pointers
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   743
                 */
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   744
                if ((unsigned)indx < (__BYTES2OBJS__(nbytes))) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   745
                    OBJ *op;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   746
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   747
                    op = (OBJ *)pFirst + indx;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   748
                    RETURN ( *op );
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   749
                }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   750
                break;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   751
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   752
            case __MASKSMALLINT(BYTEARRAY):
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   753
                /*
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   754
                 * (unsigned) bytes
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   755
                 */
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   756
                if ((unsigned)indx < nbytes) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   757
                    unsigned char *cp;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   758
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   759
                    cp = (unsigned char *)pFirst + indx;
8913
b9498d27a554 64bit; mkSmallInteger
Claus Gittinger <cg@exept.de>
parents: 8909
diff changeset
   760
                    RETURN ( __mkSmallInteger( (*cp & 0xFF)) );
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   761
                }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   762
                break;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   763
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   764
            case __MASKSMALLINT(FLOATARRAY):
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   765
                /*
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   766
                 * native floats
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   767
                 */
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   768
                if ((unsigned)indx < (nbytes / sizeof(float))) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   769
                    float *fp;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   770
                    float f;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   771
                    OBJ v;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   772
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   773
                    fp = (float *)pFirst + indx;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   774
                    f = *fp;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   775
                    if (f == 0.0) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   776
                        v = __float0;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   777
                    } else {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   778
                        __qMKSFLOAT(v, f);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   779
                    }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   780
                    RETURN (v);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   781
                }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   782
                break;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   783
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   784
            case __MASKSMALLINT(DOUBLEARRAY):
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   785
                /*
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   786
                 * native doubles
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   787
                 */
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   788
#ifdef __NEED_DOUBLE_ALIGN
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   789
                if ((INT)pFirst & (__DOUBLE_ALIGN-1)) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   790
                    int delta = __DOUBLE_ALIGN - ((INT)pFirst & (__DOUBLE_ALIGN-1));
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   791
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   792
                    pFirst += delta;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   793
                    nbytes -= delta;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   794
                }
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   795
#endif
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   796
                if ((unsigned)indx < (nbytes / sizeof(double))) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   797
                    double *dp;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   798
                    double d;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   799
                    OBJ v;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   800
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   801
                    dp = (double *)pFirst + indx;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   802
                    d = *dp;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   803
                    if (d == 0.0) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   804
                        v = __float0;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   805
                    } else {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   806
                        __qMKFLOAT(v, d);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   807
                    }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   808
                    RETURN (v);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   809
                }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   810
                break;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   811
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   812
            case __MASKSMALLINT(WORDARRAY):
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   813
                /*
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   814
                 * unsigned 16bit ints
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   815
                 */
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   816
                /* Notice: the hard coded shifts are by purpose;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   817
                 * it makes us independent of the short-size of the machine
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   818
                 */
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   819
                if ((unsigned)indx < (nbytes>>1)) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   820
                    unsigned short *sp;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   821
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   822
                    sp = (unsigned short *)(pFirst + (indx<<1));
8913
b9498d27a554 64bit; mkSmallInteger
Claus Gittinger <cg@exept.de>
parents: 8909
diff changeset
   823
                    RETURN ( __mkSmallInteger( (*sp & 0xFFFF)) );
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   824
                }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   825
                break;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   826
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   827
            case __MASKSMALLINT(SWORDARRAY):
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   828
                /*
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   829
                 * signed 16bit ints
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   830
                 */
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   831
                /* Notice: the hard coded shifts are by purpose;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   832
                 * it makes us independent of the short-size of the machine
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   833
                 */
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   834
                if ((unsigned)indx < (nbytes>>1)) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   835
                    short *ssp;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   836
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   837
                    ssp = (short *)(pFirst + (indx<<1));
8913
b9498d27a554 64bit; mkSmallInteger
Claus Gittinger <cg@exept.de>
parents: 8909
diff changeset
   838
                    RETURN ( __mkSmallInteger( (*ssp) ));
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   839
                }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   840
                break;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   841
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   842
            case __MASKSMALLINT(LONGARRAY):
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   843
                /*
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   844
                 * unsigned 32bit ints
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   845
                 */
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   846
                /* Notice: the hard coded shifts are by purpose;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   847
                 * it makes us independent of the int-size of the machine
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   848
                 */
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   849
                if ((unsigned)indx < (nbytes>>2)) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   850
                    unsigned int32 ul;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   851
                    unsigned int32 *lp;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   852
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   853
                    lp = (unsigned int32 *)(pFirst + (indx<<2));
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   854
                    ul = *lp;
8901
824a89d0b5c7 alpha64 vs. POINTER_SIZE cleanup
Claus Gittinger <cg@exept.de>
parents: 8892
diff changeset
   855
#if __POINTER_SIZE__ == 8
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   856
                    {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   857
                        unsigned  INT ull = (unsigned INT)ul;
8913
b9498d27a554 64bit; mkSmallInteger
Claus Gittinger <cg@exept.de>
parents: 8909
diff changeset
   858
                        RETURN ( __mkSmallInteger(ull) );
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   859
                    }
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   860
#else
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   861
                    if (ul <= _MAX_INT) {
8913
b9498d27a554 64bit; mkSmallInteger
Claus Gittinger <cg@exept.de>
parents: 8909
diff changeset
   862
                        RETURN ( __mkSmallInteger(ul) );
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   863
                    }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   864
                    RETURN ( __MKULARGEINT(ul) );
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   865
#endif
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   866
                }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   867
                break;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   868
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   869
            case __MASKSMALLINT(SLONGARRAY):
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   870
                /*
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   871
                 * signed 32bit ints
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   872
                 */
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   873
                /* Notice: the hard coded shifts are by purpose;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   874
                 * it makes us independent of the int-size of the machine
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   875
                 */
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   876
                if ((unsigned)indx < (nbytes>>2)) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   877
                    int32 *slp;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   878
                    int32 l;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   879
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   880
                    slp = (int32 *)(pFirst + (indx<<2));
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   881
                    l = *slp;
8901
824a89d0b5c7 alpha64 vs. POINTER_SIZE cleanup
Claus Gittinger <cg@exept.de>
parents: 8892
diff changeset
   882
#if __POINTER_SIZE__ == 8
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   883
                    {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   884
                        INT ll = (INT)l;
8913
b9498d27a554 64bit; mkSmallInteger
Claus Gittinger <cg@exept.de>
parents: 8909
diff changeset
   885
                        RETURN ( __mkSmallInteger(ll) );
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   886
                    }
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   887
#else
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   888
                    if (__ISVALIDINTEGER(l)) {
8913
b9498d27a554 64bit; mkSmallInteger
Claus Gittinger <cg@exept.de>
parents: 8909
diff changeset
   889
                        RETURN ( __mkSmallInteger(l) );
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   890
                    }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   891
                    RETURN ( __MKLARGEINT(l) );
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   892
#endif
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   893
                }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   894
                break;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   895
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   896
            case __MASKSMALLINT(SLONGLONGARRAY):
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   897
                /*
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   898
                 * signed 64bit longlongs
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   899
                 */
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   900
#ifdef __NEED_LONGLONG_ALIGN
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   901
                if ((INT)pFirst & (__LONGLONG_ALIGN-1)) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   902
                    int delta = __LONGLONG_ALIGN - ((INT)pFirst & (__LONGLONG_ALIGN-1));
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   903
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   904
                    pFirst += delta;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   905
                    nbytes -= delta;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   906
                }
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   907
#endif
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   908
                /* Notice: the hard coded shifts are by purpose;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   909
                 * it makes us independent of the long/longlong-size of the machine
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   910
                 */
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   911
                if ((unsigned)indx < (nbytes>>3)) {
8901
824a89d0b5c7 alpha64 vs. POINTER_SIZE cleanup
Claus Gittinger <cg@exept.de>
parents: 8892
diff changeset
   912
#if __POINTER_SIZE__ == 8
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   913
                    INT *slp, ll;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   914
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   915
                    slp = (INT *)(pFirst + (indx<<3));
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   916
                    ll = *slp;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   917
                    if (__ISVALIDINTEGER(ll)) {
8913
b9498d27a554 64bit; mkSmallInteger
Claus Gittinger <cg@exept.de>
parents: 8909
diff changeset
   918
                        RETURN ( __mkSmallInteger(ll) );
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   919
                    }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   920
                    RETURN ( __MKLARGEINT(ll) );
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   921
#else
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   922
                    __int64__ *llp;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   923
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   924
                    llp = (__int64__ *)(pFirst + (indx<<3));
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   925
                    RETURN (__MKINT64(llp));
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   926
#endif
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   927
                }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   928
                break;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   929
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   930
            case __MASKSMALLINT(LONGLONGARRAY):
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   931
                /*
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   932
                 * unsigned 64bit longlongs
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   933
                 */
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   934
#ifdef __NEED_LONGLONG_ALIGN
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   935
                if ((INT)pFirst & (__LONGLONG_ALIGN-1)) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   936
                    int delta = __LONGLONG_ALIGN - ((INT)pFirst & (__LONGLONG_ALIGN-1));
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   937
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   938
                    pFirst += delta;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   939
                    nbytes -= delta;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   940
                }
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   941
#endif
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   942
                /* Notice: the hard coded shifts are by purpose;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   943
                 * it makes us independent of the long/longlong-size of the machine
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   944
                 */
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   945
                if ((unsigned)indx < (nbytes>>3)) {
8901
824a89d0b5c7 alpha64 vs. POINTER_SIZE cleanup
Claus Gittinger <cg@exept.de>
parents: 8892
diff changeset
   946
#if __POINTER_SIZE__ == 8
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   947
                    unsigned INT *ulp, ul;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   948
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   949
                    ulp = (unsigned INT *)(pFirst + (indx<<3));
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   950
                    ul = *ulp;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   951
                    if (ul <= _MAX_INT) {
8913
b9498d27a554 64bit; mkSmallInteger
Claus Gittinger <cg@exept.de>
parents: 8909
diff changeset
   952
                        RETURN ( __mkSmallInteger(ul) );
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   953
                    }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   954
                    RETURN ( __MKULARGEINT(ul) );
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   955
#else
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   956
                    __uint64__ *llp;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   957
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   958
                    llp = (__uint64__ *)(pFirst + (indx<<3));
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   959
                    RETURN (__MKUINT64(llp));
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   960
#endif
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   961
                }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   962
                break;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   963
        }
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   964
    }
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   965
%}.
7216
59bfa2ffdcf7 utility
Claus Gittinger <cg@exept.de>
parents: 7215
diff changeset
   966
    ^ self indexNotIntegerOrOutOfBounds:index
5755
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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   969
basicAt:index put:anObject
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   970
    "store the 2nd arg, anObject as indexed instvar with index, anInteger.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   971
     Returns anObject (sigh).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   972
     Trigger an error if the receiver has no indexed instance variables.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   973
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   974
     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
   975
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   976
%{  /* NOCONTEXT */
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   977
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   978
    register int nbytes, indx;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   979
    OBJ myClass;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   980
    register char *pFirst;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   981
/*    int nInstBytes, ninstvars, flags; */
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   982
    REGISTER int n;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   983
    unsigned int u;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   984
    int val;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   985
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   986
    /* notice the missing test for self being a nonNilObject -
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   987
       this can be done since basicAt: is defined both in UndefinedObject
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   988
       and SmallInteger */
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   989
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   990
    if (__isSmallInteger(index)) {
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   991
        indx = __intVal(index) - 1;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   992
        myClass = __qClass(self);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   993
        n /* ninstvars */ = __intVal(__ClassInstPtr(myClass)->c_ninstvars);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   994
        n /* nInstBytes */ = OHDR_SIZE + __OBJS2BYTES__(n /* ninstvars */);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   995
        nbytes = __qSize(self) - n /* nInstBytes */;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   996
        pFirst = (char *)(__InstPtr(self)) + n /* nInstBytes */;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   997
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   998
        switch ((INT)(__ClassInstPtr(myClass)->c_flags) & __MASKSMALLINT(ARRAYMASK)) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
   999
            case __MASKSMALLINT(POINTERARRAY):
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1000
            case __MASKSMALLINT(WKPOINTERARRAY):
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1001
                if ((unsigned)indx < (__BYTES2OBJS__(nbytes))) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1002
                    OBJ *op;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1003
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1004
                    op = (OBJ *)pFirst + indx;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1005
                    *op = anObject;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1006
                    __STORE(self, anObject);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1007
                    RETURN ( anObject );
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1008
                }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1009
                break;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1010
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1011
            case __MASKSMALLINT(BYTEARRAY):
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1012
                if (__isSmallInteger(anObject)) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1013
                    val = __intVal(anObject);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1014
                    if ((val & ~0xFF) == 0 /* i.e. (val >= 0) && (val <= 255) */) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1015
                        if ((unsigned)indx < nbytes) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1016
                            char *cp;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1017
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1018
                            cp = pFirst + indx;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1019
                            *cp = val;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1020
                            RETURN ( anObject );
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1021
                        }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1022
                    }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1023
                }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1024
                break;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1025
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1026
            case __MASKSMALLINT(FLOATARRAY):
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1027
                if ((unsigned)indx < (nbytes / sizeof(float))) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1028
                    float *fp;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1029
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1030
                    fp = (float *)pFirst + indx;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1031
                    if (anObject != nil) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1032
                        if (! __isSmallInteger(anObject)) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1033
                            if (__qIsFloatLike(anObject)) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1034
                                *fp = (float)(__floatVal(anObject));
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1035
                                RETURN ( anObject );
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1036
                            }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1037
                            if (__qIsShortFloat(anObject)) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1038
                                *fp = __shortFloatVal(anObject);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1039
                                RETURN ( anObject );
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1040
                            }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1041
                        } else {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1042
                            *fp = (float) __intVal(anObject);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1043
                            RETURN ( anObject );
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1044
                        }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1045
                    }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1046
                }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1047
                break;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1048
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1049
            case __MASKSMALLINT(DOUBLEARRAY):
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1050
#ifdef __NEED_DOUBLE_ALIGN
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1051
                if ((INT)pFirst & (__DOUBLE_ALIGN-1)) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1052
                    int delta = __DOUBLE_ALIGN - ((INT)pFirst & (__DOUBLE_ALIGN-1));
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1053
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1054
                    pFirst += delta;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1055
                    nbytes -= delta;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1056
                }
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1057
#endif
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1058
                if ((unsigned)indx < (nbytes / sizeof(double))) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1059
                    double *dp;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1060
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1061
                    dp = (double *)pFirst + indx;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1062
                    if (anObject != nil) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1063
                        if (! __isSmallInteger(anObject)) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1064
                            if (__qIsFloatLike(anObject)) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1065
                                *dp = __floatVal(anObject);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1066
                                RETURN ( anObject );
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1067
                            }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1068
                            if (__qIsShortFloat(anObject)) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1069
                                *dp = (double)__shortFloatVal(anObject);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1070
                                RETURN ( anObject );
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1071
                            }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1072
                        } else {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1073
                            *dp = (double) __intVal(anObject);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1074
                            RETURN ( anObject );
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1075
                        }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1076
                    }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1077
                }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1078
                break;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1079
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1080
            case __MASKSMALLINT(WORDARRAY):
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1081
                if (__isSmallInteger(anObject)) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1082
                    val = __intVal(anObject);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1083
                    if ((unsigned)val <= 0xFFFF) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1084
                        if ((unsigned)indx < (nbytes>>1)) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1085
                            unsigned short *sp;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1086
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1087
                            sp = (unsigned short *)(pFirst + (indx<<1));
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1088
                            *sp = val;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1089
                            RETURN ( anObject );
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1090
                        }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1091
                    }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1092
                }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1093
                break;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1094
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1095
            case __MASKSMALLINT(SWORDARRAY):
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1096
                if (__isSmallInteger(anObject)) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1097
                    val = __intVal(anObject);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1098
                    if ((val >= -32768) && (val < 32768)) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1099
                        if ((unsigned)indx < (nbytes>>1)) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1100
                            short *ssp;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1101
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1102
                            ssp = (short *)(pFirst + (indx<<1));
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1103
                            *ssp = val;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1104
                            RETURN ( anObject );
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1105
                        }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1106
                    }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1107
                }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1108
                break;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1109
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1110
            case __MASKSMALLINT(SLONGARRAY):
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1111
                if ((unsigned)indx < (nbytes>>2)) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1112
                    int32 *slp;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1113
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1114
                    slp = (int32 *)(pFirst + (indx<<2));
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1115
                    if (__isSmallInteger(anObject)) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1116
                        *slp = __intVal(anObject);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1117
                        RETURN ( anObject );
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1118
                    }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1119
                    n = __signedLongIntVal(anObject);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1120
                    /*
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1121
                     * zero means failure for an int larger than 4 bytes 
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1122
                     * (would be a smallInteger) 
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1123
                     */
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1124
                    if (n) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1125
                        *slp = n;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1126
                        RETURN ( anObject );
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1127
                    }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1128
                }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1129
                break;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1130
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1131
            case __MASKSMALLINT(LONGARRAY):
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1132
                if ((unsigned)indx < (nbytes>>2)) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1133
                    unsigned int32 *lp;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1134
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1135
                    lp = (unsigned int32 *)(pFirst + (indx<<2));
8913
b9498d27a554 64bit; mkSmallInteger
Claus Gittinger <cg@exept.de>
parents: 8909
diff changeset
  1136
                    if (anObject == __mkSmallInteger(0)) {
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1137
                        *lp = 0;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1138
                        RETURN ( anObject );
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1139
                    }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1140
                    u = __longIntVal(anObject);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1141
                    /*
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1142
                     * zero means failure for an int larger than 4 bytes
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1143
                     * (would be a smallInteger)
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1144
                     */
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1145
                    if (u) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1146
                        *lp = u;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1147
                        RETURN ( anObject );
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1148
                    }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1149
                }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1150
                break;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1151
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1152
            case __MASKSMALLINT(SLONGLONGARRAY):
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1153
#ifdef __NEED_LONGLONG_ALIGN
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1154
                if ((INT)pFirst & (__LONGLONG_ALIGN-1)) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1155
                    int delta = __LONGLONG_ALIGN - ((INT)pFirst & (__LONGLONG_ALIGN-1));
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1156
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1157
                    pFirst += delta;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1158
                    nbytes -= delta;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1159
                }
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1160
#endif
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1161
                if ((unsigned)indx < (nbytes>>3)) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1162
                    __int64__ ll;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1163
                    __int64__ *sllp;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1164
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1165
                    sllp = (__int64__ *)(pFirst + (indx<<3));
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1166
8913
b9498d27a554 64bit; mkSmallInteger
Claus Gittinger <cg@exept.de>
parents: 8909
diff changeset
  1167
                    if (anObject == __mkSmallInteger(0)) {
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1168
                        ll.lo = ll.hi = 0;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1169
                        *sllp = ll;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1170
                        RETURN ( anObject );
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1171
                    }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1172
                    if (__signedLong64IntVal(anObject, &ll)) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1173
                        *sllp = ll;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1174
                        RETURN ( anObject );
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1175
                    }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1176
                }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1177
                break;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1178
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1179
            case __MASKSMALLINT(LONGLONGARRAY):
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1180
#ifdef __NEED_LONGLONG_ALIGN
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1181
                if ((INT)pFirst & (__LONGLONG_ALIGN-1)) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1182
                    int delta = __LONGLONG_ALIGN - ((INT)pFirst & (__LONGLONG_ALIGN-1));
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1183
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1184
                    pFirst += delta;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1185
                    nbytes -= delta;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1186
                }
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1187
#endif
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1188
                if ((unsigned)indx < (nbytes>>3)) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1189
                    __uint64__ ll;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1190
                    __uint64__ *llp;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1191
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1192
                    llp = (__uint64__ *)(pFirst + (indx<<3));
8913
b9498d27a554 64bit; mkSmallInteger
Claus Gittinger <cg@exept.de>
parents: 8909
diff changeset
  1193
                    if (anObject == __mkSmallInteger(0)) {
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1194
                        ll.lo = ll.hi = 0;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1195
                        *llp = ll;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1196
                        RETURN ( anObject );
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1197
                    }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1198
                    if (__unsignedLong64IntVal(anObject, &ll)) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1199
                        *llp = ll;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1200
                        RETURN ( anObject );
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1201
                    }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1202
                }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1203
                break;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1204
        }
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1205
    }
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1206
%}.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1207
    index isInteger ifFalse:[
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1208
        "
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1209
         the index should be an integer number
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1210
        "
7215
733294e1a8cc correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 7211
diff changeset
  1211
        ^ self indexNotInteger:index
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1212
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1213
    (index between:1 and:self size) ifFalse:[
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1214
        "
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1215
         the index is less than 1 or greater than the size of the
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1216
         receiver collection
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1217
        "
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1218
        ^ self subscriptBoundsError:index
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1219
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1220
    (self class isFloatsOrDoubles) ifTrue:[
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1221
        anObject isNumber ifTrue:[
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1222
            ^ self basicAt:index put:(anObject asFloat)
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1223
        ]
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1224
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1225
    anObject isInteger ifFalse:[
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1226
        "
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1227
         the object to put into the receiver collection
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1228
         should be an integer number
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1229
        "
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1230
        ^ self elementNotInteger
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1231
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1232
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1233
     the object to put into the receiver collection
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1234
     is not an instance of the expected element class,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1235
     or the value is  not within the elements valid range.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1236
    "
7215
733294e1a8cc correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 7211
diff changeset
  1237
    ^ self elementBoundsError:anObject
5755
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
    "Modified: 19.4.1996 / 11:14:10 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1240
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1241
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1242
byteAt:index
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1243
    "return the byte at index. 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1244
     This is only allowed for non-pointer indexed objects
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1245
     (i.e. byteArrays, wordArrays, floatArrays etc.).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1246
     The receivers indexed instvars are treated as an uninterpreted
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1247
     collection of bytes.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1248
     Only useful with binary storage."
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
%{  /* NOCONTEXT */
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1251
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1252
    REGISTER int indx;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1253
    int nIndex;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1254
    REGISTER OBJ slf;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1255
    REGISTER OBJ cls;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1256
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1257
    if (__isSmallInteger(index)) {
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1258
        slf = self;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1259
        if (__isNonNilObject(slf)) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1260
            unsigned char *pFirst;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1261
            int nIndex;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1262
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1263
            cls = __qClass(slf);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1264
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1265
            pFirst = __byteArrayVal(slf);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1266
            pFirst += __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars));
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1267
            nIndex = __byteArraySize(slf);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1268
            indx = __intVal(index) - 1;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1269
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1270
            switch ((INT)(__ClassInstPtr(cls)->c_flags) & __MASKSMALLINT(ARRAYMASK)) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1271
                case __MASKSMALLINT(DOUBLEARRAY):
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1272
#ifdef __NEED_DOUBLE_ALIGN
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1273
                    if ((INT)pFirst & (__DOUBLE_ALIGN-1)) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1274
                        int delta = __DOUBLE_ALIGN - ((INT)pFirst & (__DOUBLE_ALIGN-1));
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1275
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1276
                        pFirst += delta;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1277
                        nIndex -= delta;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1278
                    }
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1279
#endif
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1280
                    /* fall into */
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1281
                case __MASKSMALLINT(BYTEARRAY):
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1282
                case __MASKSMALLINT(WORDARRAY):
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1283
                case __MASKSMALLINT(LONGARRAY):
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1284
                case __MASKSMALLINT(SWORDARRAY):
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1285
                case __MASKSMALLINT(SLONGARRAY):
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1286
                case __MASKSMALLINT(FLOATARRAY):
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1287
                    if ((unsigned)indx < (unsigned)nIndex) {
8913
b9498d27a554 64bit; mkSmallInteger
Claus Gittinger <cg@exept.de>
parents: 8909
diff changeset
  1288
                        RETURN ( __mkSmallInteger( (INT)(pFirst[indx])) );
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1289
                    }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1290
                    break;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1291
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1292
                case __MASKSMALLINT(LONGLONGARRAY):
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1293
                case __MASKSMALLINT(SLONGLONGARRAY):
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1294
#ifdef __NEED_LONGLONG_ALIGN
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1295
                    if ((INT)pFirst & (__LONGLONG_ALIGN-1)) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1296
                        int delta = __LONGLONG_ALIGN - ((INT)pFirst & (__LONGLONG_ALIGN-1));
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1297
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1298
                        pFirst += delta;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1299
                        nIndex -= delta;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1300
                    }
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1301
#endif
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1302
                    if ((unsigned)indx < (unsigned)nIndex) {
8913
b9498d27a554 64bit; mkSmallInteger
Claus Gittinger <cg@exept.de>
parents: 8909
diff changeset
  1303
                        RETURN ( __mkSmallInteger( (INT)(pFirst[indx])) );
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1304
                    }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1305
                    break;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1306
            }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1307
        }
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1308
    }
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1309
%}.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1310
    "/ index not integer or index out of range
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1311
    "/ or non-byte indexable receiver
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
    ^ self primitiveFailed
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1314
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1315
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1316
     Point new byteAt:1
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1317
     (ByteArray with:1 with:2) byteAt:2
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1318
     (WordArray with:1) byteAt:1       
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1319
     (FloatArray with:1.0) byteAt:2 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1320
     'hello' byteAt:1               
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
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1323
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1324
byteAt:index put:byteValue
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1325
    "set the byte at index. 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1326
     This is only allowed for non-pointer indexed objects
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1327
     (i.e. byteArrays, wordArrays, floatArrays etc.).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1328
     The receivers indexed instvars are treated as an uninterpreted
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1329
     collection of bytes.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1330
     Only useful with binary storage."
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
%{  /* NOCONTEXT */
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1333
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1334
    REGISTER int indx;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1335
    int val, nIndex;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1336
    REGISTER OBJ slf;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1337
    REGISTER OBJ cls;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1338
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1339
    if (__bothSmallInteger(index, byteValue)) {
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1340
        val = __intVal(byteValue);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1341
        if ((unsigned)(val) <= 0xFF /* i.e. (val >= 0) && (val <= 255) */) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1342
            slf = self;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1343
            if (__isNonNilObject(slf)) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1344
                cls = __qClass(slf);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1345
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1346
                indx = __intVal(index) - 1;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1347
                switch ((INT)(__ClassInstPtr(cls)->c_flags) & __MASKSMALLINT(ARRAYMASK)) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1348
                    case __MASKSMALLINT(BYTEARRAY):
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1349
                    case __MASKSMALLINT(WORDARRAY):
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1350
                    case __MASKSMALLINT(LONGARRAY):
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1351
                    case __MASKSMALLINT(SWORDARRAY):
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1352
                    case __MASKSMALLINT(SLONGARRAY):
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1353
                    case __MASKSMALLINT(LONGLONGARRAY):
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1354
                    case __MASKSMALLINT(SLONGLONGARRAY):
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1355
                    case __MASKSMALLINT(FLOATARRAY):
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1356
                    case __MASKSMALLINT(DOUBLEARRAY):
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1357
                        indx += __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars));
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1358
                        nIndex = __byteArraySize(slf);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1359
                        if ((unsigned)indx < (unsigned)nIndex) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1360
                            __ByteArrayInstPtr(slf)->ba_element[indx] = val;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1361
                            RETURN ( byteValue );
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1362
                        }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1363
                        break;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1364
                }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1365
            }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1366
        }
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1367
    }
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1368
%}.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1369
    "/ index not integer or index out of range
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1370
    "/ or non-byte indexable receiver
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
    ^ self primitiveFailed
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1373
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1374
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1375
     (ByteArray with:1 with:2) byteAt:2 put:3; yourself
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1376
     'hello' copy byteAt:1 put:105; yourself              
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
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1379
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1380
instVarAt:index
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1381
    "return a non-indexed instance variable;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1382
     peeking into an object this way is not very object oriented 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1383
     - use with care (needed for copy, inspector etc.)"
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
%{  /* NOCONTEXT */
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1386
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1387
    OBJ myClass;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1388
    int idx, ninstvars;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1389
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1390
    if (__isSmallInteger(index)) {
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1391
        myClass = __Class(self);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1392
        idx = __intVal(index) - 1;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1393
        /*
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1394
         * do not allow returning of non-object fields.
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1395
         * if subclass did not make privisions for that,
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1396
         * we wont do so here ...
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1397
         */
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1398
        if (((INT)(__ClassInstPtr(myClass)->c_flags) & __MASKSMALLINT(NONOBJECT_INSTS))) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1399
            if (idx == 0) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1400
                RETURN ( nil )
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1401
            }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1402
        }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1403
        ninstvars = __intVal(__ClassInstPtr(myClass)->c_ninstvars);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1404
        if ((idx >= 0) && (idx < ninstvars)) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1405
            RETURN ( __InstPtr(self)->i_instvars[idx] );
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1406
        }
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1407
    }
7216
59bfa2ffdcf7 utility
Claus Gittinger <cg@exept.de>
parents: 7215
diff changeset
  1408
%}.
59bfa2ffdcf7 utility
Claus Gittinger <cg@exept.de>
parents: 7215
diff changeset
  1409
    ^ self indexNotIntegerOrOutOfBounds:index
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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1412
instVarAt:index put:value
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1413
    "change a non-indexed instance variable;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1414
     peeking into an object this way is not very object oriented 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1415
     - use with care (needed for copy, inspector etc.)"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1416
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1417
%{  /* NOCONTEXT */
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
    OBJ myClass;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1420
    int idx, ninstvars;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1421
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1422
    if (__isSmallInteger(index)) {
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1423
        myClass = __Class(self);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1424
        idx = __intVal(index) - 1;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1425
        ninstvars = __intVal(__ClassInstPtr(myClass)->c_ninstvars);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1426
        /*
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1427
         * do not allow setting of non-object fields.
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1428
         * if subclass did not make privisions for that,
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1429
         * we wont do so here ...
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1430
         */
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1431
        if (((INT)(__ClassInstPtr(myClass)->c_flags) & __MASKSMALLINT(NONOBJECT_INSTS))) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1432
            if (idx == 0) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1433
                RETURN ( nil )
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1434
            }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1435
        }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1436
        if ((idx >= 0) && (idx < ninstvars)) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1437
            __InstPtr(self)->i_instvars[idx] = value;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1438
            __STORE(self, value);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1439
            RETURN ( value );
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1440
        }
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1441
    }
7216
59bfa2ffdcf7 utility
Claus Gittinger <cg@exept.de>
parents: 7215
diff changeset
  1442
%}.
59bfa2ffdcf7 utility
Claus Gittinger <cg@exept.de>
parents: 7215
diff changeset
  1443
    ^ self indexNotIntegerOrOutOfBounds:index
5755
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
instVarNamed:name 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1447
    "return a non-indexed instance variables value by name;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1448
     peeking into an object this way is not very object oriented 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1449
     - 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
  1450
     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
  1451
     parsed ad runtime)"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1452
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1453
    ^ self instVarAt:(self class instVarOffsetOf:name)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1454
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1455
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1456
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1457
     |p|
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
     p := Point x:10 y:20.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1460
     p instVarNamed:'x'  
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
    "Modified: 19.4.1996 / 11:12:39 / cg"
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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1466
instVarNamed:name ifAbsent:exceptionBlock
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1467
    "return a non-indexed instance variables value by name,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1468
     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
  1469
     peeking into an object this way is not very object oriented 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1470
     - 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
  1471
     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
  1472
     parsed ad runtime)"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1473
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1474
    |idx|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1475
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1476
    idx := self class instVarOffsetOf:name.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1477
    idx isNil ifTrue:[^ exceptionBlock value].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1478
    ^ self instVarAt:idx
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
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
     |p|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1483
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1484
     p := Point x:10 y:20.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1485
     p instVarNamed:'x'  
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
    "Created: 6.7.1996 / 23:02:49 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1489
    "Modified: 6.7.1996 / 23:03:41 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1490
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1491
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1492
instVarNamed:name put:value
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1493
    "set a non-indexed instance variable by name;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1494
     peeking into an object this way is not very object oriented 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1495
     - if at all, use with care (provided for protocol completeness).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1496
     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
  1497
     parsed ad runtime)"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1498
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1499
    ^ self instVarAt:(self class instVarOffsetOf:name) put:value
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1500
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1501
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1502
     |p|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1503
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1504
     p := Point x:10 y:20.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1505
     p instVarNamed:'x' put:30.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1506
     p  
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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1509
    "Modified: 19.4.1996 / 11:12:49 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1510
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1511
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1512
!Object methodsFor:'attributes access'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1513
6323
9dbabd4270d3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6321
diff changeset
  1514
objectAttributeAt:attributeKey 
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1515
    "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
  1516
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1517
    | attrs |
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1518
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1519
    attrs := self objectAttributes.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1520
    (attrs notNil and:[attrs size > 0]) ifTrue:[
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1521
        ^ attrs at:attributeKey ifAbsent:[]
5755
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
    ^ nil
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
    "Created: / 22.1.1998 / 21:29:17 / av"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1526
    "Modified: / 3.2.1998 / 18:55:55 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1527
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1528
6323
9dbabd4270d3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6321
diff changeset
  1529
objectAttributeAt:attributeKey put:anObject
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1530
    "store the attribute anObject referenced by key into the receiver"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1531
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1532
    "/ must do this save from interrupts, since the attributes collection
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1533
    "/ is possibly accessed from multiple threads ...
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1534
    [
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1535
        | attrs |
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1536
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1537
        attrs := self objectAttributes.
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1538
        (attrs isNil or:[attrs size == 0]) ifTrue:[
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1539
            attrs := WeakIdentityDictionary new.
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1540
            attrs at:attributeKey put:anObject.
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1541
            self objectAttributes:attrs.
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1542
        ] ifFalse:[ 
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1543
            attrs at:attributeKey put:anObject.
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1544
        ].
6323
9dbabd4270d3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6321
diff changeset
  1545
    ] valueUninterruptably
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1546
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1547
    "Attaching additional attributes (slots) to an arbitrary object:
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1548
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1549
     |p|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1550
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1551
     p := Point new.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1552
     p objectAttributeAt:#color put:#green.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1553
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1554
     p objectAttributeAt:#color
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1555
    "
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
    "Created: / 22.1.1998 / 21:29:25 / av"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1558
    "Modified: / 3.2.1998 / 18:57:58 / cg"
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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1561
objectAttributes
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1562
    "return a Collection of attributes - nil if there is none.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1563
     The default implementation here uses a global WeakDictionary to store
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1564
     attributes
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1565
     This may be too slow for high frequency slot access,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1566
     therefore, some classes may redefine this for better performance.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1567
     Notice the mentioning of a WeakDictionary - read the classes documentation."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1568
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1569
    ^ ObjectAttributes at:self ifAbsent:[nil]
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1570
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1571
    "Created: / 22.1.1998 / 21:29:30 / av"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1572
    "Modified: / 18.2.2000 / 11:34:16 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1573
!
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:aCollection
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1576
    "set the collection of attributes.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1577
     The default implementation here uses a global Dictionary to store
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1578
     attributes which may be too slow for high frequency change&update.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1579
     Therefore, some classes may redefine this for better performance."
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
    "/ must do this save from interrupts, since the attributes collection
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1582
    "/ is possibly accessed from multiple threads.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1583
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1584
    (OperatingSystem blockInterrupts) ifTrue:[
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1585
        "/ the common case - already blocked
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1586
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1587
        (aCollection isNil or:[aCollection isEmpty]) ifTrue:[
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1588
            ObjectAttributes removeKey:self ifAbsent:nil
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1589
        ] ifFalse:[
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1590
            ObjectAttributes at:self put:aCollection
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1591
        ].
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1592
        ^ self
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1593
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1594
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1595
    [
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1596
        (aCollection isNil or:[aCollection isEmpty]) ifTrue:[
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1597
            ObjectAttributes removeKey:self ifAbsent:nil
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1598
        ] ifFalse:[
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1599
            ObjectAttributes at:self put:aCollection
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1600
        ].
6421
58dca33cf0fc #valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents: 6418
diff changeset
  1601
    ] ensure:[
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1602
        OperatingSystem unblockInterrupts
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1603
    ]
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1604
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1605
    "Created: / 22.1.1998 / 21:29:35 / av"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1606
    "Modified: / 3.2.1998 / 18:58:10 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1607
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1608
6323
9dbabd4270d3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6321
diff changeset
  1609
removeObjectAttribute:attributeKey
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1610
    "make the argument, anObject be no attribute of the receiver"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1611
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1612
    "/ must do this save from interrupts, since the attributes collection
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1613
    "/ is possibly accessed from multiple threads.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1614
    [
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1615
        |attrs n a|
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1616
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1617
        attrs := self objectAttributes.
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1618
        attrs size == 0 ifTrue:[
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1619
            self objectAttributes:nil
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1620
        ] ifFalse:[
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1621
            attrs removeKey:attributeKey ifAbsent:nil.
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1622
            attrs size == 0 ifTrue:[
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1623
                self objectAttributes:nil
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1624
            ]
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1625
        ]
6323
9dbabd4270d3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6321
diff changeset
  1626
    ] valueUninterruptably
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1627
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1628
    "Created: / 22.1.1998 / 21:29:39 / av"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1629
    "Modified: / 18.2.2000 / 11:32:19 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1630
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1631
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1632
!Object methodsFor:'binary storage'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1633
6900
3b1eafe032b2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6884
diff changeset
  1634
binaryStoreBytes
3b1eafe032b2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6884
diff changeset
  1635
    ^ ByteArray streamContents:[:s | self storeBinaryOn:s].
3b1eafe032b2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6884
diff changeset
  1636
3b1eafe032b2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6884
diff changeset
  1637
    "
3b1eafe032b2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6884
diff changeset
  1638
     #('hello' 1 1.234) binaryStoreBytes
8409
5c6578c5d003 comment
Claus Gittinger <cg@exept.de>
parents: 8404
diff changeset
  1639
     'hello' asUnicode16String binaryStoreBytes
5c6578c5d003 comment
Claus Gittinger <cg@exept.de>
parents: 8404
diff changeset
  1640
5c6578c5d003 comment
Claus Gittinger <cg@exept.de>
parents: 8404
diff changeset
  1641
     Object fromBinaryStoreBytes:
5c6578c5d003 comment
Claus Gittinger <cg@exept.de>
parents: 8404
diff changeset
  1642
        ('hello' asUnicode16String binaryStoreBytes)
6900
3b1eafe032b2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6884
diff changeset
  1643
    "
3b1eafe032b2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6884
diff changeset
  1644
!
3b1eafe032b2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6884
diff changeset
  1645
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1646
hasSpecialBinaryRepresentation
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1647
    "return true, if the receiver has a special binary representation;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1648
     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
  1649
     their own storeBinary/readBinary methods.
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
     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
  1652
     special classes such as True, False, UndefinedObject or SmallInteger.
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
     If your instances should be stored in a special way, see
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1655
     #representBinaryOn: and #readBinaryContentsFromdata:manager:."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1656
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1657
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1658
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1659
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1660
readBinaryContentsFrom:stream manager:manager
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1661
    "reconstruct the receivers instance variables by reading a binary
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1662
     binary representation from stream. 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1663
     This is a general implementation, walking over instances 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1664
     and loading each recursively using manager.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1665
     Redefined by some classes to read a more compact representations
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1666
     (see String, SmallInteger etc).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1667
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1668
     Notice, that the object is already recreated as an empty corps
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1669
     with instance variables all nil and bit-instances (bytes, words etc.) 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1670
     already read and restored.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1671
8546
7fd1cb9aa20e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8542
diff changeset
  1672
     Also notice: this method is not called, if a private representation
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1673
     has been stored (see representBinaryOn:). 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1674
     In that case, #readBinaryContentsFromData:manager: is called, which
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1675
     has to be reimplemented in the objects class."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1676
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1677
    |size "{ Class: SmallInteger }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1678
     instvarArray|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1679
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1680
    stream next == 1 ifTrue:[
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1681
        "/
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1682
        "/ special representation ...
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1683
        "/
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1684
        instvarArray := Array new:(size := stream nextNumber:3).
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1685
        1 to:size do:[:i |
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1686
            instvarArray basicAt:i put:(manager nextObject)
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1687
        ].
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1688
        self readBinaryContentsFromData:instvarArray manager:manager.
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1689
        ^ self
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1690
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1691
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1692
    "/
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1693
    "/ standard representation
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1694
    "/
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1695
    size := self basicSize.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1696
    size ~~ 0 ifTrue:[
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1697
        self class isPointers ifTrue:[
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1698
            1 to:size do:[:i |
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1699
                self basicAt:i put:(manager nextObject)
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1700
            ]
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1701
        ]
5755
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
    size := self class instSize.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1704
    1 to:size do:[:i |
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1705
        self instVarAt:i put:(manager nextObject)
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1706
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1707
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1708
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1709
readBinaryContentsFromData:instvarArray manager:manager
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1710
    "reconstruct the receivers instance variables by filling instance
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1711
     variables with values from instvarArray. This array contains the instvars
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1712
     as specified in #representBinaryOn: when the object was stored.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1713
     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
  1714
     same order from that array."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1715
6721
e5f47c6e2f40 #subclassResponsibility & #subclassResponsibility:
Claus Gittinger <cg@exept.de>
parents: 6718
diff changeset
  1716
    ^ self subclassResponsibility:'method must be reimplemented in subclass for binary storage'
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1717
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1718
    "typical implementation (see also comment in #representBinaryOn:)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1719
     (for an object with foo, bar and baz as instance variables,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1720
      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
  1721
      some constant string)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1722
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1723
        foo := instvarArray at:1.
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1724
        bar := instvarArray at:2.
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1725
        baz := 'aConstant'.
5755
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
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1728
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1729
representBinaryOn:manager
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1730
    "this method is called by the storage manager to ask objects
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1731
     if they wish to provide their own binary representation.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1732
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1733
     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
  1734
     instance variables (named & indexed pointer) to be stored. 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1735
     If not redefined, this method returns nil which means that all 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1736
     instance variables are to be stored.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1737
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1738
     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
  1739
     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
  1740
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1741
     If this is redefined returning non-nil, the corresponding class needs
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1742
     a redefined instance method named #readBinaryContentsFromData:manager:
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1743
     which has to fill the receivers named (and optionally indexed pointer)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1744
     instance variables with corresponding values from a data array."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1745
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1746
    ^ nil
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1747
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1748
    "typical implementation:  
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1749
     (see also comment in #readBinaryContentsFromData:manager:)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1750
     for an object with foo, bar and baz as instance variables,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1751
     which does not want to store baz:
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1752
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1753
     representBinaryOn:manager
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1754
        |data|
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1755
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1756
        data := Array new:2.
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1757
        data at:1 put:foo.
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1758
        data at:2 put:bar.
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1759
        ^ data
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1760
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1761
!
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
storeBinaryDefinitionBodyOn:stream manager:manager
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1764
    "append a binary representation of the receivers body onto stream.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1765
     This is a general implementation walking over instances storing
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1766
     each recursively as an ID using manager.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1767
     Can be redefined in subclasses."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1768
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1769
    |basicSize    "{ Class: SmallInteger }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1770
     instSize     "{ Class: SmallInteger }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1771
     specialSize  "{ Class: SmallInteger }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1772
     myClass specialRep pointers|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1773
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1774
    myClass := self class.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1775
    instSize := myClass instSize.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1776
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1777
    (pointers := myClass isPointers) ifTrue:[
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1778
        "/
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1779
        "/ inst size not needed - if you uncomment the line below,
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1780
        "/ also uncomment the corresponding line in
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1781
        "/ Object>>binaryDefinitionFrom:manager:
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1782
        "/
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1783
        "/ stream nextPut:instSize. "mhmh this limits us to 255 named instvars"
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1784
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1785
        myClass isVariable ifTrue:[
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1786
            stream nextNumber:3 put:(basicSize := self basicSize)
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1787
        ] ifFalse:[
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1788
            basicSize := 0
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1789
        ].
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1790
    ] ifFalse: [
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1791
        stream nextNumber:4 put:(basicSize := self basicSize).
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1792
        myClass isBytes ifTrue:[
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1793
            1 to:basicSize do:[:i |
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1794
                stream nextPut:(self basicAt:i)
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1795
            ]
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1796
        ] ifFalse:[
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1797
            myClass isWords ifTrue:[
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1798
                1 to:basicSize do:[:i |
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1799
                    stream nextNumber:2 put:(self basicAt: i)
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1800
                ]
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1801
            ] ifFalse:[
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1802
                myClass isLongs ifTrue:[
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1803
                    1 to:basicSize do:[:i |
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1804
                        stream nextNumber:4 put:(self basicAt: i)
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1805
                    ]
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1806
                ] ifFalse:[
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1807
                    myClass isFloats ifTrue:[
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1808
                        "could do it in one big write on machines which use IEEE floats ..."
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1809
                        1 to:basicSize do:[:i |
7359
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  1810
                            ShortFloat storeBinaryIEEESingle:(self basicAt:i) on:stream
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1811
                        ]
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1812
                    ] ifFalse:[
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1813
                        myClass isDoubles ifTrue:[
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1814
                            "could do it in one big write on machines which use IEEE doubles ..."
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1815
                            1 to:basicSize do:[:i |
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1816
                                Float storeBinaryIEEEDouble:(self basicAt:i) on:stream
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1817
                            ]
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1818
                        ] ifFalse:[
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1819
                            "/ should never be reached ...
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1820
                            1 to:basicSize do:[:i |
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1821
                                manager putIdOf:(self basicAt:i) on:stream
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1822
                            ]
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1823
                        ]
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1824
                    ]
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1825
                ]
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1826
            ]
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1827
        ].
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1828
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1829
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1830
    (pointers or:[instSize ~~ 0]) ifTrue:[
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1831
        specialRep := self representBinaryOn:manager.
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1832
        specialRep notNil ifTrue:[
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1833
            specialSize := specialRep basicSize.
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1834
            stream nextPut:1.     "/ means: private representation follows
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1835
            stream nextNumber:3 put:specialSize.
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1836
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1837
            1 to:specialSize do:[:i |
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1838
                manager putIdOf:(specialRep at:i) on:stream
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1839
            ].
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1840
        ] ifFalse:[
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1841
            stream nextPut:0.     "/ means: normal representation follows
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1842
                                  "/ index pointers followed by named instanceVars
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1843
            pointers ifTrue:[
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1844
                basicSize ~~ 0 ifTrue:[
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1845
                    1 to:basicSize do:[:i |
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1846
                        manager putIdOf:(self basicAt:i) on:stream
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1847
                    ].
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1848
                ].
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1849
            ].
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1850
            instSize ~~ 0 ifTrue:[
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1851
                1 to:instSize do:[:i |
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1852
                    manager putIdOf:(self instVarAt:i) on:stream
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1853
                ]
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1854
            ].
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1855
        ]
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1856
    ]
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1857
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1858
    "Modified: / 2.11.1997 / 14:43:29 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1859
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1860
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1861
storeBinaryDefinitionOn:stream manager:manager
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1862
    "append a binary representation of the receiver onto stream.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1863
     This is an internal interface for binary storage mechanism.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1864
     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
  1865
     in a separate method to allow redefinition of the bodies format.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1866
     Can be redefined in subclasses to write more compact representations
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1867
     (see String, SmallInteger etc)."
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
    manager putIdOfClass:(self class) on:stream.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1870
    self storeBinaryDefinitionBodyOn:stream manager:manager
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1871
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1872
    "Modified: 23.4.1996 / 09:31:12 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1873
!
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
storeBinaryOn:aStreamOrFilename
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1876
    "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
  1877
     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
  1878
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1879
    BinaryOutputManager store:self on:aStreamOrFilename
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1880
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1881
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1882
     |a s1 s2|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1883
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1884
     s1 := 'hello'.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1885
     s2 := 'world'.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1886
     a := Array new:5.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1887
     a at:1 put:s1.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1888
     a at:2 put:s2.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1889
     a at:3 put:s1.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1890
     a at:4 put:s2.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1891
     a storeBinaryOn:'test.boss'
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
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1895
     (BinaryObjectStorage onOld:'test.boss' asFilename readStream)
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1896
        next
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1897
            inspect
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1898
    "
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
    "Modified: / 1.11.1997 / 21:16:24 / cg"
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
storeBinaryOn:stream manager:manager
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1904
    "append a binary representation of the receiver onto stream."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1905
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1906
    manager putIdOf:self on:stream
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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1909
!Object methodsFor:'change & update'!
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
broadcast:aSelectorSymbol
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1912
    "send a message with selector aSelectorSymbol to all my dependents"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1913
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1914
    self dependentsDo:[:dependent | 
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1915
        dependent perform:aSelectorSymbol
5755
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
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1918
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1919
broadcast:aSelectorSymbol with:anArgument
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1920
    "send a message with selector aSelectorSymbol with an additional
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1921
     argument anArgument to all my dependents."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1922
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1923
    self dependentsDo:[:dependent | 
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1924
        dependent perform:aSelectorSymbol with:anArgument
5755
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
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1927
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1928
changeRequest
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1929
    "the receiver wants to change - check if all dependents
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1930
     grant the request, and return true if so"
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
    self dependentsDo:[:dependent | 
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1933
        dependent updateRequest ifFalse:[^ false].
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1934
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1935
    ^ true
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1936
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1937
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1938
changeRequest:aParameter
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1939
    "the receiver wants to change - check if all dependents
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1940
     grant the request, and return true if so"
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
    self dependentsDo:[:dependent | 
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1943
        (dependent updateRequest:aParameter) ifFalse:[^ false].
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1944
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1945
    ^ true
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1946
!
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
changeRequest:aParameter from:anObject
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1949
    "the receiver wants to change - check if all dependents
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1950
     except anObject grant the request, and return true if so.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1951
     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
  1952
     about to send the change request."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1953
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1954
    self dependentsDo:[:dependent | 
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1955
        dependent == anObject ifFalse:[
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1956
            (dependent updateRequest:aParameter) ifFalse:[^ false].
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1957
        ]
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1958
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1959
    ^ true
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1960
!
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
changeRequestFrom:anObject
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1963
    "the receiver wants to change - check if all dependents
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1964
     except anObject grant the request, and return true if so.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1965
     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
  1966
     about to send the change request."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1967
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1968
    self dependentsDo:[:dependent | 
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1969
        dependent == anObject ifFalse:[
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1970
            (dependent updateRequest) ifFalse:[^ false].
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1971
        ]
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1972
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1973
    ^ true
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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1976
changed
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1977
    "notify all dependents that the receiver has changed.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1978
     Each dependent gets a '#update:'-message with the original
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1979
     receiver as argument."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1980
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1981
    self changed:nil
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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1984
changed:aParameter
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1985
    "notify all dependents that the receiver has changed somehow.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1986
     Each dependent gets a '#update:'-message with aParameter
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1987
     as argument."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1988
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1989
    self changed:aParameter with:nil
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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1992
changed:aParameter with:anArgument
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1993
    "notify all dependents that the receiver has changed somehow.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1994
     Each dependent gets a  '#update:with:from:'-message, with aParameter
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1995
     and anArgument as arguments."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1996
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1997
    self dependentsDo:[:dependent | 
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  1998
        dependent update:aParameter with:anArgument from:self
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1999
    ]
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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2002
update:aParameter
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2003
    "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
  2004
     on whom the receiver depends, has changed. The argument aParameter
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2005
     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
  2006
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2007
     Default behavior here is to do nothing"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2008
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2009
    ^ self
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2010
!
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
update:aParameter with:anArgument
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2013
    "dependent is notified of some change -
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2014
     Default is to try update:"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2015
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2016
    ^ self update:aParameter
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2017
!
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
update:aParameter with:anArgument from:sender
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2020
    "dependent is notified of some change -
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2021
     Default is to try update:with:"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2022
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2023
    ^ self update:aParameter with:anArgument
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2024
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2025
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2026
updateRequest
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2027
    "return true, if an update request is granted.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2028
     Default here is to grant updates - may be used
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2029
     to lock updates if someone is making other changes
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2030
     from within an update. Or if someone has locked its
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2031
     state and does not want others to change things.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2032
     However, these dependents must all honor the
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2033
     changeRequest - ifTrue - change protocol. I.e. they
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2034
     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
  2035
     it returns true. The others must decide in updateRequest and
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2036
     return true if they think a change is ok."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2037
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2038
    ^ true
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2039
!
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
updateRequest:aSymbol
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2042
    "return true, if an update request is granted.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2043
     Default here a simple updateRequest"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2044
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2045
    ^ self updateRequest
7177
2bfa42d795a0 added withoutUpdating:do:
martin
parents: 7159
diff changeset
  2046
!
2bfa42d795a0 added withoutUpdating:do:
martin
parents: 7159
diff changeset
  2047
2bfa42d795a0 added withoutUpdating:do:
martin
parents: 7159
diff changeset
  2048
withoutUpdating:someone do:aBlock
2bfa42d795a0 added withoutUpdating:do:
martin
parents: 7159
diff changeset
  2049
    "evaluate a block but remove someone from my dependents temporarily"
2bfa42d795a0 added withoutUpdating:do:
martin
parents: 7159
diff changeset
  2050
2bfa42d795a0 added withoutUpdating:do:
martin
parents: 7159
diff changeset
  2051
    (self dependents includesIdentical:someone)
2bfa42d795a0 added withoutUpdating:do:
martin
parents: 7159
diff changeset
  2052
    ifFalse:[
2bfa42d795a0 added withoutUpdating:do:
martin
parents: 7159
diff changeset
  2053
        ^ aBlock value.
2bfa42d795a0 added withoutUpdating:do:
martin
parents: 7159
diff changeset
  2054
    ].
2bfa42d795a0 added withoutUpdating:do:
martin
parents: 7159
diff changeset
  2055
    self removeDependent:someone.
2bfa42d795a0 added withoutUpdating:do:
martin
parents: 7159
diff changeset
  2056
    ^ aBlock ensure:[ self addDependent:someone ]
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2057
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2058
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2059
!Object methodsFor:'cleanup'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2060
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2061
lowSpaceCleanup
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2062
    "ignored here - redefined in some classes to
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2063
     cleanup in low-memory situations"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2064
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2065
    ^ self
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2066
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2067
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2068
!Object methodsFor:'comparing'!
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
= anObject
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2071
    "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
  2072
     Notice:
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2073
        This method is partially open coded (inlined) by the compiler(s)
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2074
        identical objects are always considered equal.
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2075
        redefining it may not work as expected."
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2076
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2077
    ^ self == anObject
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2078
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2079
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2080
== anObject
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2081
    "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
  2082
     Never redefine this in any class.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2083
     Notice:
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2084
        This method is open coded (inlined) by the compiler(s)
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2085
        - redefining it may not work as expected."
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2086
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2087
%{  /* NOCONTEXT */
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2088
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2089
    RETURN ( (self == anObject) ? true : false );
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2090
%}
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2091
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2092
5814
f4f6da3e7631 Define #deepSameContentsAs:
Stefan Vogel <sv@exept.de>
parents: 5806
diff changeset
  2093
deepSameContentsAs:anObject
f4f6da3e7631 Define #deepSameContentsAs:
Stefan Vogel <sv@exept.de>
parents: 5806
diff changeset
  2094
    "return true, if the receiver and the arg have the same contents
f4f6da3e7631 Define #deepSameContentsAs:
Stefan Vogel <sv@exept.de>
parents: 5806
diff changeset
  2095
     in both the named instance vars and any indexed instVars.
f4f6da3e7631 Define #deepSameContentsAs:
Stefan Vogel <sv@exept.de>
parents: 5806
diff changeset
  2096
     This method descends into referenced objects, where #sameContentsAs: does not descend"
f4f6da3e7631 Define #deepSameContentsAs:
Stefan Vogel <sv@exept.de>
parents: 5806
diff changeset
  2097
5821
c11bb6c8cc8f Cleanup unused method vars
Stefan Vogel <sv@exept.de>
parents: 5814
diff changeset
  2098
    |myClass val
5814
f4f6da3e7631 Define #deepSameContentsAs:
Stefan Vogel <sv@exept.de>
parents: 5806
diff changeset
  2099
     sz "{ Class: SmallInteger }" |
f4f6da3e7631 Define #deepSameContentsAs:
Stefan Vogel <sv@exept.de>
parents: 5806
diff changeset
  2100
f4f6da3e7631 Define #deepSameContentsAs:
Stefan Vogel <sv@exept.de>
parents: 5806
diff changeset
  2101
    myClass := self class.
f4f6da3e7631 Define #deepSameContentsAs:
Stefan Vogel <sv@exept.de>
parents: 5806
diff changeset
  2102
    myClass isVariable ifTrue:[
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2103
        sz := self basicSize.
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2104
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2105
        "compare the indexed variables"
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2106
        1 to:sz do:[:i |
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2107
            val := self basicAt:i.
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2108
            val isLiteral ifTrue:[
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2109
                val = (anObject basicAt:i) ifFalse:[^ false].
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2110
            ] ifFalse:[
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2111
                (val deepSameContentsAs:(anObject basicAt:i)) ifFalse:[^ false].
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2112
            ]
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2113
        ]
5814
f4f6da3e7631 Define #deepSameContentsAs:
Stefan Vogel <sv@exept.de>
parents: 5806
diff changeset
  2114
    ].
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
    "compare the instance variables"
f4f6da3e7631 Define #deepSameContentsAs:
Stefan Vogel <sv@exept.de>
parents: 5806
diff changeset
  2117
    sz := myClass instSize.
f4f6da3e7631 Define #deepSameContentsAs:
Stefan Vogel <sv@exept.de>
parents: 5806
diff changeset
  2118
    1 to:sz do:[:i | 
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2119
        val := self instVarAt:i.
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2120
        val isLiteral ifTrue:[
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2121
            val = (anObject instVarAt:i) ifFalse:[^ false].
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2122
        ] ifFalse:[
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2123
            (val deepSameContentsAs:(anObject instVarAt:i)) ifFalse:[^ false].
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2124
        ]
5814
f4f6da3e7631 Define #deepSameContentsAs:
Stefan Vogel <sv@exept.de>
parents: 5806
diff changeset
  2125
    ].
f4f6da3e7631 Define #deepSameContentsAs:
Stefan Vogel <sv@exept.de>
parents: 5806
diff changeset
  2126
f4f6da3e7631 Define #deepSameContentsAs:
Stefan Vogel <sv@exept.de>
parents: 5806
diff changeset
  2127
    ^ true
f4f6da3e7631 Define #deepSameContentsAs:
Stefan Vogel <sv@exept.de>
parents: 5806
diff changeset
  2128
f4f6da3e7631 Define #deepSameContentsAs:
Stefan Vogel <sv@exept.de>
parents: 5806
diff changeset
  2129
    "
f4f6da3e7631 Define #deepSameContentsAs:
Stefan Vogel <sv@exept.de>
parents: 5806
diff changeset
  2130
     #(1 2 3 4) deepSameContentsAs:#[1 2 3 4] asArray 
f4f6da3e7631 Define #deepSameContentsAs:
Stefan Vogel <sv@exept.de>
parents: 5806
diff changeset
  2131
     (1@2) deepSameContentsAs:(1->2)
f4f6da3e7631 Define #deepSameContentsAs:
Stefan Vogel <sv@exept.de>
parents: 5806
diff changeset
  2132
    "
f4f6da3e7631 Define #deepSameContentsAs:
Stefan Vogel <sv@exept.de>
parents: 5806
diff changeset
  2133
!
f4f6da3e7631 Define #deepSameContentsAs:
Stefan Vogel <sv@exept.de>
parents: 5806
diff changeset
  2134
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2135
hash
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2136
    "return an Integer useful as a hash key for the receiver.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2137
     This hash should return same values for objects with same
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2138
     contents (i.e. use this to hash on structure)"
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
    ^ self identityHash
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2141
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2142
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2143
identityHash
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2144
    "return an Integer useful as a hash key for the receiver.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2145
     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
  2146
     this to hash on identity of objects).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2147
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2148
     We cannot use the Objects address (as other smalltalks do) since
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2149
     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
  2150
     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
  2151
     Id in the object header itself as its hashed upon.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2152
     (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
  2153
     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
  2154
     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
  2155
     hashed-upon objects could add an instvar containing the hash value."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2156
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2157
%{  /* NOCONTEXT */
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2158
5806
a7361ebe686a avoid warnings on alpha (int-size)
Claus Gittinger <cg@exept.de>
parents: 5769
diff changeset
  2159
    REGISTER unsigned INT hash;
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2160
    static unsigned nextHash = 0;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2161
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2162
    if (__isNonNilObject(self)) {
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2163
        hash = __GET_HASH(self);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2164
        if (hash == 0) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2165
            /* has no hash yet */
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2166
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2167
            if (++nextHash > __MAX_HASH__) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2168
                nextHash = 1;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2169
            }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2170
            hash = nextHash;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2171
            __SET_HASH(self, hash);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2172
        }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2173
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2174
        /*
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2175
         * now, we got 11 bits for hashing;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2176
         * make it as large as possible; since most hashers use the returned
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2177
         * key and take it modulo some prime number, this will allow for
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2178
         * better distribution (i.e. bigger empty spaces) in hashed collection.
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2179
         */
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2180
        hash = __MAKE_HASH__(hash);
8913
b9498d27a554 64bit; mkSmallInteger
Claus Gittinger <cg@exept.de>
parents: 8909
diff changeset
  2181
        RETURN ( __mkSmallInteger(hash) );
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
%}.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2184
    ^ 0 "never reached, since redefined in UndefinedObject and SmallInteger"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2185
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2186
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2187
identityHashForBinaryStore
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2188
    "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
  2189
     and does not #become something else, while the hash is used.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2190
     This is only used by the binary storage mechanism, during the
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2191
     object writing phase."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2192
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2193
%{  /* NOCONTEXT */
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2194
5806
a7361ebe686a avoid warnings on alpha (int-size)
Claus Gittinger <cg@exept.de>
parents: 5769
diff changeset
  2195
    REGISTER unsigned INT hash, hash1, hash2, sz;
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2196
    OBJ o;
5806
a7361ebe686a avoid warnings on alpha (int-size)
Claus Gittinger <cg@exept.de>
parents: 5769
diff changeset
  2197
    static unsigned INT nextHash = 0;
a7361ebe686a avoid warnings on alpha (int-size)
Claus Gittinger <cg@exept.de>
parents: 5769
diff changeset
  2198
    static unsigned INT nextClassHash = 0;
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2199
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2200
    if (__isNonNilObject(self)) {
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2201
        /*
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2202
         * my own identityHash
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2203
         */
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2204
        hash1 = __GET_HASH(self);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2205
        if (hash1 == 0) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2206
            /* has no hash yet */
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2207
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2208
            if (++nextHash > __MAX_HASH__) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2209
                nextHash = 1;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2210
            }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2211
            hash1 = nextHash;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2212
            __SET_HASH(self, hash1);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2213
        }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2214
        /*
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2215
         * my classes identityHash
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2216
         */
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2217
        o = __qClass(self);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2218
        hash2 = __GET_HASH(o);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2219
        if (hash2 == 0) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2220
            /* has no hash yet */
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2221
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2222
            if (++nextClassHash > __MAX_HASH__) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2223
                nextClassHash = 1;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2224
            }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2225
            hash2 = nextClassHash;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2226
            __SET_HASH(o, hash2);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2227
        }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2228
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2229
        /*
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2230
         * some bits of my size
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2231
         */
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2232
        sz = __qSize(self);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2233
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2234
        /*
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2235
         * now, we got 11 + 11 + 8 bits for hashing;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2236
         * make it as large as possible; since most hashers use the returned
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2237
         * key and take it modulo some prime number, this will allow for
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2238
         * better distribution (i.e. bigger empty spaces) in hashed collection.
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2239
         */
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2240
        hash = (hash1 << 11) | hash2;           /* 22 bits */
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2241
        hash = (hash << 8) | (sz & 0xFC);       /* 30 bits */
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2242
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2243
        while ((hash & 0x20000000) == 0) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2244
            hash <<= 1;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2245
        }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2246
8913
b9498d27a554 64bit; mkSmallInteger
Claus Gittinger <cg@exept.de>
parents: 8909
diff changeset
  2247
        RETURN ( __mkSmallInteger(hash) );
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2248
    }
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2249
%}.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2250
    "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
  2251
    ^ self identityHash
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
sameContentsAs:anObject
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2255
    "return true, if the receiver and the arg have the same contents
7121
5ce61b826f0e sameContentsAs: comment.
Claus Gittinger <cg@exept.de>
parents: 7112
diff changeset
  2256
     in both the named instance vars and any indexed instVars.
5ce61b826f0e sameContentsAs: comment.
Claus Gittinger <cg@exept.de>
parents: 7112
diff changeset
  2257
     The code here only checks if values present in the receiver are also
5ce61b826f0e sameContentsAs: comment.
Claus Gittinger <cg@exept.de>
parents: 7112
diff changeset
  2258
     present in the arg, not vice versa.
5ce61b826f0e sameContentsAs: comment.
Claus Gittinger <cg@exept.de>
parents: 7112
diff changeset
  2259
     I.e. the argument may be bigger and/or have more instance variables."
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2260
5821
c11bb6c8cc8f Cleanup unused method vars
Stefan Vogel <sv@exept.de>
parents: 5814
diff changeset
  2261
    |myClass
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2262
     sz "{ Class: SmallInteger }" |
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2263
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2264
    myClass := self class.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2265
    myClass isVariable ifTrue:[
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2266
        sz := self basicSize.
7121
5ce61b826f0e sameContentsAs: comment.
Claus Gittinger <cg@exept.de>
parents: 7112
diff changeset
  2267
        anObject basicSize >= sz ifFalse:[^ false].
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2268
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2269
        "compare the indexed variables"
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2270
        1 to:sz do:[:i | 
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2271
            (self basicAt:i) == (anObject basicAt:i) ifFalse:[^ false].
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2272
        ]
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2273
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2274
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2275
    "compare the instance variables"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2276
    sz := myClass instSize.
7121
5ce61b826f0e sameContentsAs: comment.
Claus Gittinger <cg@exept.de>
parents: 7112
diff changeset
  2277
    anObject instSize >= sz ifFalse:[^ false].
5ce61b826f0e sameContentsAs: comment.
Claus Gittinger <cg@exept.de>
parents: 7112
diff changeset
  2278
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2279
    1 to:sz do:[:i | 
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2280
        (self instVarAt:i) == (anObject instVarAt:i) ifFalse:[^ false].
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2281
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2282
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2283
    ^ true
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2284
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2285
    "
5814
f4f6da3e7631 Define #deepSameContentsAs:
Stefan Vogel <sv@exept.de>
parents: 5806
diff changeset
  2286
     #(1 2 3 4) sameContentsAs:#[1 2 3 4] asArray 
f4f6da3e7631 Define #deepSameContentsAs:
Stefan Vogel <sv@exept.de>
parents: 5806
diff changeset
  2287
     (1@2) sameContentsAs:(1->2)
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2288
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2289
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2290
    "Created: / 21.4.1998 / 15:56:40 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2291
    "Modified: / 21.4.1998 / 15:58:15 / cg"
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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2294
~= anObject
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2295
    "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
  2296
     Notice:
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2297
        This method is partially open coded (inlined) by the compiler(s)
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2298
        identical objects are never considered unequal.
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2299
        redefining it may not work as expected."
5755
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
    ^ (self = anObject) not
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2302
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2303
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2304
~~ anObject
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2305
    "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
  2306
     Never redefine this in any class.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2307
     Notice:
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2308
        This method is open coded (inlined) by the compiler(s)
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2309
        - redefining it may not work as expected."
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2310
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2311
%{  /* NOCONTEXT */
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2312
    RETURN ( (self == anObject) ? false : true );
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2313
%}
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
!Object methodsFor:'converting'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2317
6696
36eaa6c17e2c use excla for conses (looks better);
Claus Gittinger <cg@exept.de>
parents: 6656
diff changeset
  2318
!! anObject
6652
4cfba8cb0652 typo and undo renaming of #/#cons:
Stefan Vogel <sv@exept.de>
parents: 6647
diff changeset
  2319
    "return a cons with the receiver as car and the argument as cdr"
4cfba8cb0652 typo and undo renaming of #/#cons:
Stefan Vogel <sv@exept.de>
parents: 6647
diff changeset
  2320
4cfba8cb0652 typo and undo renaming of #/#cons:
Stefan Vogel <sv@exept.de>
parents: 6647
diff changeset
  2321
    ^ Cons car:self cdr:anObject
6697
326f50b595f6 comment
Claus Gittinger <cg@exept.de>
parents: 6696
diff changeset
  2322
326f50b595f6 comment
Claus Gittinger <cg@exept.de>
parents: 6696
diff changeset
  2323
    "
6698
be8668e8a87e comment
Claus Gittinger <cg@exept.de>
parents: 6697
diff changeset
  2324
     (1 !! 2)                
be8668e8a87e comment
Claus Gittinger <cg@exept.de>
parents: 6697
diff changeset
  2325
     (#car !! #cdr)          
be8668e8a87e comment
Claus Gittinger <cg@exept.de>
parents: 6697
diff changeset
  2326
     (1 !! (2 !! (3 !! nil)))    
be8668e8a87e comment
Claus Gittinger <cg@exept.de>
parents: 6697
diff changeset
  2327
     (1 !! 2) !! (2 !! 3)    
6697
326f50b595f6 comment
Claus Gittinger <cg@exept.de>
parents: 6696
diff changeset
  2328
    "
6652
4cfba8cb0652 typo and undo renaming of #/#cons:
Stefan Vogel <sv@exept.de>
parents: 6647
diff changeset
  2329
!
4cfba8cb0652 typo and undo renaming of #/#cons:
Stefan Vogel <sv@exept.de>
parents: 6647
diff changeset
  2330
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2331
-> anObject
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2332
    "return an association with the receiver as key and
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2333
     the argument as value"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2334
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2335
    ^ Association key:self value:anObject
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2336
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2337
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2338
asCollection
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2339
    "return myself as a Collection.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2340
     Redefined in collection to return themself."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2341
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2342
    ^ Array with:self
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2343
!
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
asSequenceableCollection
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2346
    "return myself as a SequenceableCollection.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2347
     Redefined in SequenceableCollection"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2348
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2349
    ^ Array with:self
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2350
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2351
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2352
asValue
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2353
    "return a valueHolder for for the receiver"
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
    ^ ValueHolder with:self
6146
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
  2356
!
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
  2357
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
  2358
collect
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
  2359
    "return mySelf"
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
  2360
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
  2361
    ^ self
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
  2362
!
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
  2363
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
  2364
deepCollect
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
  2365
    "return mySelf"
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
  2366
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
  2367
    ^ self
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
  2368
!
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
  2369
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
  2370
deepSelect
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
  2371
    "return mySelf"
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
  2372
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
  2373
    ^ self
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
  2374
!
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
  2375
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
  2376
select
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
  2377
    "return mySelf"
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
  2378
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
  2379
    ^ self
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2380
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2381
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2382
!Object methodsFor:'copying'!
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
cloneFrom:anObject 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2385
    "Helper for copy:
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2386
     copy all instance variables from anObject into the receiver,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2387
     which should be of the same class as the argument."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2388
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2389
    self cloneFrom:anObject performing:#yourself
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2390
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2391
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2392
     |x|
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
     x := Array new:3.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2395
     x cloneFrom:#(1 2 3).
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
cloneFrom:anObject performing:aSymbol
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2400
    "Helper for copy:
8383
dea5311899c5 comments in copy methods
Claus Gittinger <cg@exept.de>
parents: 8377
diff changeset
  2401
     for each instance variable from anObject, send it aSymbol
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2402
     and store the result into the receiver,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2403
     which should be of the same class as the argument."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2404
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2405
    |myClass sz "{ Class: SmallInteger }" t |
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2406
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2407
    myClass := self class.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2408
    myClass isVariable ifTrue:[
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2409
        sz := self basicSize.
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2410
8383
dea5311899c5 comments in copy methods
Claus Gittinger <cg@exept.de>
parents: 8377
diff changeset
  2411
        "process the indexed instance variables"
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2412
        1 to:sz do:[:i | 
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2413
            t := anObject basicAt:i.
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2414
            aSymbol ~~ #yourself ifTrue:[
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2415
                t := t perform:aSymbol.
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2416
            ].
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2417
            self basicAt:i put:t.
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2418
        ]
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2419
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2420
8383
dea5311899c5 comments in copy methods
Claus Gittinger <cg@exept.de>
parents: 8377
diff changeset
  2421
    "process the named instance variables"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2422
    sz := myClass instSize.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2423
    1 to:sz do:[:i | 
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2424
        t := anObject instVarAt:i.
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2425
        aSymbol ~~ #yourself ifTrue:[
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2426
            t := t perform:aSymbol
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2427
        ].
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2428
        self instVarAt:i put:t
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2429
    ].
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
    ^ self
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
cloneInstanceVariablesFrom:aPrototype
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2435
    "Shallow copy variables from a prototype into myself.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2436
     This copies instVars by name - i.e. same-named variables are
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2437
     copied, others are not.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2438
     The variable slots are copied as available 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2439
     (i.e. the min of both indexed sizes is used)."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2440
        
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2441
    |myInfo otherInfo|
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
    myInfo := self class instanceVariableOffsets.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2444
    otherInfo := aPrototype class instanceVariableOffsets.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2445
    myInfo keysAndValuesDo:[:name :index | |varIndexAssoc|
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2446
        varIndexAssoc := otherInfo at:name ifAbsent:[].
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2447
        varIndexAssoc notNil ifTrue:[
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2448
            self instVarAt:index put:(aPrototype instVarAt:(varIndexAssoc value))
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2449
        ]
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2450
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2451
    self isVariable ifTrue:[
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2452
        1 to:(self basicSize min:aPrototype basicSize) do:[:index |
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2453
            self basicAt:index put:(aPrototype basicAt:index)
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2454
        ].
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2455
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2456
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2457
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2458
     Class withoutUpdatingChangesDo:[
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2459
         Point subclass:#Point3D
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2460
           instanceVariableNames:'z'
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2461
           classVariableNames:''
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2462
           poolDictionaries:''
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2463
           category:'testing'.
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2464
         (Point3D new cloneInstanceVariablesFrom:1@2) inspect.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2465
     ]
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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2468
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2469
     Class withoutUpdatingChangesDo:[
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2470
         Point variableSubclass:#Point3D
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2471
           instanceVariableNames:'z'
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2472
           classVariableNames:''
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2473
           poolDictionaries:''
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2474
           category:'testing'.
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2475
         ((Point3D new:2) cloneInstanceVariablesFrom:#(1 2 3)) inspect.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2476
     ]
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
     |someObject|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2481
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2482
     Class withoutUpdatingChangesDo:[
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2483
         Object subclass:#TestClass1 
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2484
           instanceVariableNames:'foo bar'
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2485
           classVariableNames:''
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2486
           poolDictionaries:''
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2487
           category:'testing'.
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2488
         someObject := TestClass1 new.
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2489
         someObject instVarAt:1 put:'foo'; instVarAt:2 put:'bar'.
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2490
         Object subclass:#TestClass2 
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2491
           instanceVariableNames:'bar foo'
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2492
           classVariableNames:''
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2493
           poolDictionaries:''
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2494
           category:'testing'.
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2495
         (TestClass2 new cloneInstanceVariablesFrom:someObject) inspect.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2496
     ]
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2497
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2498
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2499
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2500
     |top b b1|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2501
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2502
     top := StandardSystemView new.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2503
     top extent:100@100.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2504
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2505
     b := Button in:top.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2506
     b label:'hello'.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2507
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2508
     b1 := ArrowButton new cloneInstanceVariablesFrom:b.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2509
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2510
     top open.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2511
     b1 inspect
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2512
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2513
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2514
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2515
copy
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2516
    "return a copy of the receiver - defaults to shallowcopy here.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2517
     Notice, that copy does not copy dependents."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2518
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2519
    ^ self shallowCopy postCopy
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2520
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2521
6146
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
  2522
copyToLevel:level
6962
eab0d4c42375 copyToLevel: example and comment
Claus Gittinger <cg@exept.de>
parents: 6961
diff changeset
  2523
    "a controlled deepCopy, where the number of levels can be specified.
eab0d4c42375 copyToLevel: example and comment
Claus Gittinger <cg@exept.de>
parents: 6961
diff changeset
  2524
     Notice: 
eab0d4c42375 copyToLevel: example and comment
Claus Gittinger <cg@exept.de>
parents: 6961
diff changeset
  2525
         This method DOES NOT handle cycles/self-refs and does NOT preserve object identity; 
8383
dea5311899c5 comments in copy methods
Claus Gittinger <cg@exept.de>
parents: 8377
diff changeset
  2526
         i.e. identical references in the source are copied multiple times into the copy."
6962
eab0d4c42375 copyToLevel: example and comment
Claus Gittinger <cg@exept.de>
parents: 6961
diff changeset
  2527
eab0d4c42375 copyToLevel: example and comment
Claus Gittinger <cg@exept.de>
parents: 6961
diff changeset
  2528
    |newObject class index|
6146
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
  2529
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
  2530
    level == 1 ifTrue:[^ self shallowCopy].
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
  2531
6962
eab0d4c42375 copyToLevel: example and comment
Claus Gittinger <cg@exept.de>
parents: 6961
diff changeset
  2532
    class := self class.
eab0d4c42375 copyToLevel: example and comment
Claus Gittinger <cg@exept.de>
parents: 6961
diff changeset
  2533
    newObject := self clone.
6146
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
  2534
    newObject == self ifTrue: [^ self].
6962
eab0d4c42375 copyToLevel: example and comment
Claus Gittinger <cg@exept.de>
parents: 6961
diff changeset
  2535
    class isVariable ifTrue:[ 
eab0d4c42375 copyToLevel: example and comment
Claus Gittinger <cg@exept.de>
parents: 6961
diff changeset
  2536
        index := self basicSize.
eab0d4c42375 copyToLevel: example and comment
Claus Gittinger <cg@exept.de>
parents: 6961
diff changeset
  2537
        [index > 0] whileTrue:[
eab0d4c42375 copyToLevel: example and comment
Claus Gittinger <cg@exept.de>
parents: 6961
diff changeset
  2538
            newObject basicAt: index put: ((self basicAt: index) copyToLevel:(level-1)).
eab0d4c42375 copyToLevel: example and comment
Claus Gittinger <cg@exept.de>
parents: 6961
diff changeset
  2539
            index := index - 1
eab0d4c42375 copyToLevel: example and comment
Claus Gittinger <cg@exept.de>
parents: 6961
diff changeset
  2540
        ]
eab0d4c42375 copyToLevel: example and comment
Claus Gittinger <cg@exept.de>
parents: 6961
diff changeset
  2541
    ].
eab0d4c42375 copyToLevel: example and comment
Claus Gittinger <cg@exept.de>
parents: 6961
diff changeset
  2542
    index := class instSize.
eab0d4c42375 copyToLevel: example and comment
Claus Gittinger <cg@exept.de>
parents: 6961
diff changeset
  2543
    [index > 0] whileTrue:[
eab0d4c42375 copyToLevel: example and comment
Claus Gittinger <cg@exept.de>
parents: 6961
diff changeset
  2544
        newObject instVarAt: index put: ((self instVarAt: index) copyToLevel:(level-1)).
eab0d4c42375 copyToLevel: example and comment
Claus Gittinger <cg@exept.de>
parents: 6961
diff changeset
  2545
        index := index - 1
eab0d4c42375 copyToLevel: example and comment
Claus Gittinger <cg@exept.de>
parents: 6961
diff changeset
  2546
    ].
eab0d4c42375 copyToLevel: example and comment
Claus Gittinger <cg@exept.de>
parents: 6961
diff changeset
  2547
    ^ newObject
eab0d4c42375 copyToLevel: example and comment
Claus Gittinger <cg@exept.de>
parents: 6961
diff changeset
  2548
eab0d4c42375 copyToLevel: example and comment
Claus Gittinger <cg@exept.de>
parents: 6961
diff changeset
  2549
    "
eab0d4c42375 copyToLevel: example and comment
Claus Gittinger <cg@exept.de>
parents: 6961
diff changeset
  2550
     |a b|
eab0d4c42375 copyToLevel: example and comment
Claus Gittinger <cg@exept.de>
parents: 6961
diff changeset
  2551
eab0d4c42375 copyToLevel: example and comment
Claus Gittinger <cg@exept.de>
parents: 6961
diff changeset
  2552
     a := #( 
eab0d4c42375 copyToLevel: example and comment
Claus Gittinger <cg@exept.de>
parents: 6961
diff changeset
  2553
            '1.1' 
eab0d4c42375 copyToLevel: example and comment
Claus Gittinger <cg@exept.de>
parents: 6961
diff changeset
  2554
            '1.2' 
eab0d4c42375 copyToLevel: example and comment
Claus Gittinger <cg@exept.de>
parents: 6961
diff changeset
  2555
            '1.3'
eab0d4c42375 copyToLevel: example and comment
Claus Gittinger <cg@exept.de>
parents: 6961
diff changeset
  2556
            ( 
eab0d4c42375 copyToLevel: example and comment
Claus Gittinger <cg@exept.de>
parents: 6961
diff changeset
  2557
                '1.41' 
eab0d4c42375 copyToLevel: example and comment
Claus Gittinger <cg@exept.de>
parents: 6961
diff changeset
  2558
                '1.42' 
eab0d4c42375 copyToLevel: example and comment
Claus Gittinger <cg@exept.de>
parents: 6961
diff changeset
  2559
                '1.43'
eab0d4c42375 copyToLevel: example and comment
Claus Gittinger <cg@exept.de>
parents: 6961
diff changeset
  2560
                    ( 
eab0d4c42375 copyToLevel: example and comment
Claus Gittinger <cg@exept.de>
parents: 6961
diff changeset
  2561
                        '1.441' 
eab0d4c42375 copyToLevel: example and comment
Claus Gittinger <cg@exept.de>
parents: 6961
diff changeset
  2562
                        '1.442' 
eab0d4c42375 copyToLevel: example and comment
Claus Gittinger <cg@exept.de>
parents: 6961
diff changeset
  2563
                        '1.443'
eab0d4c42375 copyToLevel: example and comment
Claus Gittinger <cg@exept.de>
parents: 6961
diff changeset
  2564
                        ( '1.4441' '1.4442' '1.4443' )
eab0d4c42375 copyToLevel: example and comment
Claus Gittinger <cg@exept.de>
parents: 6961
diff changeset
  2565
                        '1.445' 
eab0d4c42375 copyToLevel: example and comment
Claus Gittinger <cg@exept.de>
parents: 6961
diff changeset
  2566
                    )
eab0d4c42375 copyToLevel: example and comment
Claus Gittinger <cg@exept.de>
parents: 6961
diff changeset
  2567
                '1.45'
eab0d4c42375 copyToLevel: example and comment
Claus Gittinger <cg@exept.de>
parents: 6961
diff changeset
  2568
            )
eab0d4c42375 copyToLevel: example and comment
Claus Gittinger <cg@exept.de>
parents: 6961
diff changeset
  2569
            '1.5'
eab0d4c42375 copyToLevel: example and comment
Claus Gittinger <cg@exept.de>
parents: 6961
diff changeset
  2570
           ).
eab0d4c42375 copyToLevel: example and comment
Claus Gittinger <cg@exept.de>
parents: 6961
diff changeset
  2571
eab0d4c42375 copyToLevel: example and comment
Claus Gittinger <cg@exept.de>
parents: 6961
diff changeset
  2572
      b := a copyToLevel:1.
eab0d4c42375 copyToLevel: example and comment
Claus Gittinger <cg@exept.de>
parents: 6961
diff changeset
  2573
      self assert: ( (a at:1) == (b at:1) ).
eab0d4c42375 copyToLevel: example and comment
Claus Gittinger <cg@exept.de>
parents: 6961
diff changeset
  2574
      self assert: ( (a at:4) == (b at:4) ).
eab0d4c42375 copyToLevel: example and comment
Claus Gittinger <cg@exept.de>
parents: 6961
diff changeset
  2575
eab0d4c42375 copyToLevel: example and comment
Claus Gittinger <cg@exept.de>
parents: 6961
diff changeset
  2576
      b := a copyToLevel:2.
eab0d4c42375 copyToLevel: example and comment
Claus Gittinger <cg@exept.de>
parents: 6961
diff changeset
  2577
      self assert: ( (a at:1) ~~ (b at:1) ).
eab0d4c42375 copyToLevel: example and comment
Claus Gittinger <cg@exept.de>
parents: 6961
diff changeset
  2578
      self assert: ( (a at:4) ~~ (b at:4) ).
eab0d4c42375 copyToLevel: example and comment
Claus Gittinger <cg@exept.de>
parents: 6961
diff changeset
  2579
      self assert: ( ((a at:4) at:1) == ((b at:4) at:1) ).
eab0d4c42375 copyToLevel: example and comment
Claus Gittinger <cg@exept.de>
parents: 6961
diff changeset
  2580
      self assert: ( ((a at:4) at:4) == ((b at:4) at:4) ).
eab0d4c42375 copyToLevel: example and comment
Claus Gittinger <cg@exept.de>
parents: 6961
diff changeset
  2581
eab0d4c42375 copyToLevel: example and comment
Claus Gittinger <cg@exept.de>
parents: 6961
diff changeset
  2582
      b := a copyToLevel:3.
eab0d4c42375 copyToLevel: example and comment
Claus Gittinger <cg@exept.de>
parents: 6961
diff changeset
  2583
      self assert: ( (a at:1) ~~ (b at:1) ).
eab0d4c42375 copyToLevel: example and comment
Claus Gittinger <cg@exept.de>
parents: 6961
diff changeset
  2584
      self assert: ( (a at:4) ~~ (b at:4) ).
eab0d4c42375 copyToLevel: example and comment
Claus Gittinger <cg@exept.de>
parents: 6961
diff changeset
  2585
      self assert: ( ((a at:4) at:1) ~~ ((b at:4) at:1) ).
eab0d4c42375 copyToLevel: example and comment
Claus Gittinger <cg@exept.de>
parents: 6961
diff changeset
  2586
      self assert: ( ((a at:4) at:4) ~~ ((b at:4) at:4) ).
eab0d4c42375 copyToLevel: example and comment
Claus Gittinger <cg@exept.de>
parents: 6961
diff changeset
  2587
      self assert: ( (((a at:4) at:4) at:1) == (((b at:4) at:4)at:1) ).
eab0d4c42375 copyToLevel: example and comment
Claus Gittinger <cg@exept.de>
parents: 6961
diff changeset
  2588
      self assert: ( (((a at:4) at:4) at:4) == (((b at:4) at:4)at:4) ).
eab0d4c42375 copyToLevel: example and comment
Claus Gittinger <cg@exept.de>
parents: 6961
diff changeset
  2589
    "
6146
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
  2590
!
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
  2591
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2592
deepCopy
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2593
    "return a copy of the object with all subobjects also copied.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2594
     This method DOES handle cycles/self-refs and preserves object identity; 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2595
     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
  2596
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2597
     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
  2598
     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
  2599
     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
  2600
     no cycles are involved, you can use the old simpleDeepCopy, 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2601
     which avoids this overhead (but may run into trouble).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2602
     Notice, that deepCopy does not copy dependents."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2603
8383
dea5311899c5 comments in copy methods
Claus Gittinger <cg@exept.de>
parents: 8377
diff changeset
  2604
    ^ self deepCopyUsing:(IdentityDictionary new)
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2605
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2606
    "an example which is not handled by the old deepCopy:
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2607
    
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2608
     |a|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2609
     a := Array new:3.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2610
     a at:3 put:a.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2611
     a deepCopy inspect
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
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
     |a|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2616
     a := Color black onDevice:Screen current.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2617
     a deepCopy inspect
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2618
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2619
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2620
    "Modified: 27.3.1996 / 16:31:20 / stefan"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2621
!
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
deepCopyError
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2624
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2625
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2626
    "raise a signal, that deepCopy is not allowed for this object"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2627
8330
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
  2628
    ^ DeepCopyError raise
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2629
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2630
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2631
deepCopyUsing:aDictionary
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2632
    "a helper for deepCopy; return a copy of the object with 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2633
     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
  2634
     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
  2635
     This method DOES handle cycles/self references."
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
    |myClass aCopy
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2638
     sz "{ Class: SmallInteger }" 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2639
     iOrig iCopy|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2640
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2641
    myClass := self class.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2642
    myClass isVariable ifTrue:[
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2643
        sz := self basicSize.
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2644
        aCopy := myClass basicNew:sz.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2645
    ] ifFalse:[
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2646
        sz := 0.
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2647
        aCopy := myClass basicNew
5755
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
    aCopy setHashFrom:self.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2650
    aDictionary at:self put:aCopy.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2651
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2652
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2653
     copy indexed instvars - if any
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
    sz ~~ 0 ifTrue:[
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2656
        myClass isBits ifTrue:[
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2657
            "block-copy indexed instvars"
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2658
            aCopy replaceFrom:1 to:sz with:self startingAt:1
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2659
        ] ifFalse:[
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2660
            "individual deep copy the indexed variables"
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2661
            1 to:sz do:[:i | 
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2662
                iOrig := self basicAt:i.
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2663
                iOrig notNil ifTrue:[
8372
ef63fde56d72 deepCopyUsing slightly faster
ca
parents: 8371
diff changeset
  2664
                    "/ used to be dict-includesKey-ifTrue[dict-at:], 
ef63fde56d72 deepCopyUsing slightly faster
ca
parents: 8371
diff changeset
  2665
                    "/ changed to use dict-at:ifAbsent:, to avoid double lookup in dictionary
ef63fde56d72 deepCopyUsing slightly faster
ca
parents: 8371
diff changeset
  2666
                    iCopy := aDictionary at:iOrig ifAbsent:nil.
ef63fde56d72 deepCopyUsing slightly faster
ca
parents: 8371
diff changeset
  2667
                    iCopy isNil ifTrue:[
8383
dea5311899c5 comments in copy methods
Claus Gittinger <cg@exept.de>
parents: 8377
diff changeset
  2668
                        iCopy := iOrig deepCopyUsing:aDictionary
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2669
                    ].
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2670
                    aCopy basicAt:i put:iCopy
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2671
                ]
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2672
            ]
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2673
        ]
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2674
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2675
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2676
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2677
     copy the instance variables
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
    sz := myClass instSize.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2680
    1 to:sz do:[:i |
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2681
        (self skipInstvarIndexInDeepCopy:i) ifFalse:[
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2682
            iOrig := self instVarAt:i.
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2683
            iOrig notNil ifTrue:[
8372
ef63fde56d72 deepCopyUsing slightly faster
ca
parents: 8371
diff changeset
  2684
                iCopy := aDictionary at:iOrig ifAbsent:nil.
ef63fde56d72 deepCopyUsing slightly faster
ca
parents: 8371
diff changeset
  2685
                iCopy isNil ifTrue:[
8383
dea5311899c5 comments in copy methods
Claus Gittinger <cg@exept.de>
parents: 8377
diff changeset
  2686
                    iCopy := iOrig deepCopyUsing:aDictionary
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2687
                ].
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2688
                aCopy instVarAt:i put:iCopy
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2689
            ]
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2690
        ]
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2691
    ].
8383
dea5311899c5 comments in copy methods
Claus Gittinger <cg@exept.de>
parents: 8377
diff changeset
  2692
    aCopy postDeepCopyFrom:self.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2693
    ^ aCopy
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2694
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2695
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2696
     |a b c copyOfC|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2697
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2698
     a := Array with:'hello' with:'world' with:nil.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2699
     b := 99 @ 999.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2700
     a at:3 put:b.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2701
     c := Array with:a with:b with:a.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2702
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2703
     Transcript showCR: (c at:1) == (c at:3).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2704
     copyOfC := c deepCopy.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2705
     Transcript showCR: (copyOfC at:1) == (copyOfC at:3)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2706
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2707
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2708
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2709
postCopy
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2710
    "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
  2711
     cleanup after copying, while ST/X passes the original in postCopyFrom:
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2712
     (see there)"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2713
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2714
    ^ self
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2715
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2716
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2717
postDeepCopy
8930
edd42af66c0a deepCopy should not invoke postCopy
Claus Gittinger <cg@exept.de>
parents: 8913
diff changeset
  2718
    "allows for cleanup after deep copying.
edd42af66c0a deepCopy should not invoke postCopy
Claus Gittinger <cg@exept.de>
parents: 8913
diff changeset
  2719
     To be redefined in subclasses."
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2720
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2721
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2722
postDeepCopyFrom:aSource
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2723
    "allows for cleanup after deep copying"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2724
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2725
    ^ self postDeepCopy
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2726
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2727
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2728
setHashFrom:anObject
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2729
    "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
  2730
     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
  2731
     Smalltalks, and may not be available in future ST/X versions.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2732
     DO NEVER use this for normal application code."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2733
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2734
%{  /* NOCONTEXT */
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
    REGISTER unsigned h;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2737
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2738
    if (__isNonNilObject(self) && __isNonNilObject(anObject)) {
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2739
        h = __GET_HASH(anObject);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2740
        __SET_HASH(self, h);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2741
        RETURN (self);
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2742
    }
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2743
%}.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2744
    self primitiveFailed    "neither receiver not arg may be nil or SmallInteger"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2745
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2746
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2747
shallowCopy
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2748
    "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
  2749
     i.e. the copy shares referenced instvars with its original."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2750
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2751
%{  /* NOCONTEXT */
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2752
    int ninsts, spc;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2753
    int sz;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2754
    OBJ theCopy;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2755
    OBJ cls;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2756
    int flags;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2757
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2758
    cls = __qClass(self);
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2759
    flags = __intVal(__ClassInstPtr(cls)->c_flags);
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2760
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2761
    /*
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2762
     * bail out for special objects ..
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
    if (((flags & ~ARRAYMASK) == 0)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2765
     && ((flags & ARRAYMASK) != WKPOINTERARRAY)) {
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2766
        sz = __qSize(self);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2767
        __PROTECT__(self);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2768
        __qNew(theCopy, sz);    /* OBJECT ALLOCATION */
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2769
        __UNPROTECT__(self);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2770
        if (theCopy) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2771
            cls = __qClass(self);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2772
            spc = __qSpace(theCopy);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2773
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2774
            theCopy->o_class = cls; __STORE_SPC(theCopy, cls, spc);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2775
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2776
            sz = sz - OHDR_SIZE;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2777
            if (sz) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2778
                char *src, *dst;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2779
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2780
                src = (char *)(__InstPtr(self)->i_instvars);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2781
                dst = (char *)(__InstPtr(theCopy)->i_instvars);
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2782
#ifdef bcopy4
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2783
                {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2784
                    /* care for odd-number of longs */
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2785
                    int nW = sz >> 2;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2786
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2787
                    if (sz & 3) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2788
                        nW++;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2789
                    }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2790
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2791
                    bcopy4(src, dst, nW);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2792
                }
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2793
#else
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2794
                bcopy(src, dst, sz);
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2795
#endif
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2796
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2797
                flags &= ARRAYMASK;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2798
                if (flags == POINTERARRAY) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2799
                    ninsts = __BYTES2OBJS__(sz);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2800
                } else {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2801
                    ninsts = __intVal(__ClassInstPtr(cls)->c_ninstvars);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2802
                }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2803
                if (ninsts) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2804
                    do {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2805
                        OBJ el;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2806
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2807
                        el = __InstPtr(theCopy)->i_instvars[ninsts-1];
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2808
                        __STORE_SPC(theCopy, el, spc);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2809
                    } while (--ninsts);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2810
                }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2811
            }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2812
            RETURN (theCopy);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2813
        }
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2814
    }
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2815
%}.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2816
    "/ fallBack for special objects & memoryAllocation failure case
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2817
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2818
    ^ self slowShallowCopy
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2819
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2820
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2821
simpleDeepCopy
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2822
    "return a copy of the object with all subobjects also copied.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2823
     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
  2824
     slightly faster copy in situations where it is known that
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2825
     no recursive references occur (LargeIntegers for example).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2826
     NOTICE: you will run into trouble, when trying this with recursive
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2827
     objects (usually recursionInterrupt or memory-alert).
8383
dea5311899c5 comments in copy methods
Claus Gittinger <cg@exept.de>
parents: 8377
diff changeset
  2828
     This method corresponds to the 'traditional' deepCopy found in the Blue book."
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2829
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2830
    |myClass aCopy|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2831
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2832
    (myClass := self class) isVariable ifTrue:[
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2833
        aCopy := myClass basicNew:(self basicSize).
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2834
    ] ifFalse:[
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2835
        aCopy := myClass basicNew
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2836
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2837
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2838
    "copy the instance variables"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2839
    aCopy cloneFrom:self performing:#simpleDeepCopy.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2840
    ^ aCopy
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2841
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2842
    "a bad example (but ST/X should survive ...)"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2843
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2844
     |a|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2845
     a := Array new:3.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2846
     a at:3 put:a.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2847
     a simpleDeepCopy
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2848
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2849
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2850
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2851
skipInstvarIndexInDeepCopy:index
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2852
    "a helper for deepCopy; only indices for which this method returns
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2853
     false are copied in a deep copy.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2854
     The default is false here - which means that everything is copied.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2855
     Can be redefined in subclasses for partial copies"
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
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2858
!
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
slowShallowCopy
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2861
    "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
  2862
     i.e. the copy shares referenced instvars with its original.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2863
     This method is only invoked as a fallback from #shallowCopy."
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
    |myClass aCopy|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2866
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2867
    (myClass := self class) isVariable ifTrue:[
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2868
        aCopy := myClass basicNew:(self basicSize).
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2869
    ] ifFalse:[
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2870
        aCopy := myClass basicNew
5755
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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2873
    "copy the instance variables"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2874
    aCopy cloneFrom:self performing:#yourself.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2875
    ^ aCopy
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2876
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2877
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2878
!Object methodsFor:'debugging'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2879
7621
42fb582ea36b allow for blocks in assert
Claus Gittinger <cg@exept.de>
parents: 7600
diff changeset
  2880
assert:aBooleanOrBlock
6964
a9ecdb3f1e52 comments
Claus Gittinger <cg@exept.de>
parents: 6963
diff changeset
  2881
    "fail, if the argument is not true and report an error"
a9ecdb3f1e52 comments
Claus Gittinger <cg@exept.de>
parents: 6963
diff changeset
  2882
8876
dc094269db8e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8872
diff changeset
  2883
    aBooleanOrBlock == true ifTrue:[^ self].
dc094269db8e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8872
diff changeset
  2884
    "/ could still be a block or false.
dc094269db8e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8872
diff changeset
  2885
    self 
dc094269db8e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8872
diff changeset
  2886
        assert:aBooleanOrBlock 
dc094269db8e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8872
diff changeset
  2887
        message:('Assertion failed in ' , thisContext sender printString)
7621
42fb582ea36b allow for blocks in assert
Claus Gittinger <cg@exept.de>
parents: 7600
diff changeset
  2888
!
42fb582ea36b allow for blocks in assert
Claus Gittinger <cg@exept.de>
parents: 7600
diff changeset
  2889
42fb582ea36b allow for blocks in assert
Claus Gittinger <cg@exept.de>
parents: 7600
diff changeset
  2890
assert:aBooleanOrBlock message:messageIfFailing
6964
a9ecdb3f1e52 comments
Claus Gittinger <cg@exept.de>
parents: 6963
diff changeset
  2891
    "fail, if the argument is not true and report an error"
6961
096ca5ceb662 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6954
diff changeset
  2892
096ca5ceb662 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6954
diff changeset
  2893
    "{ Pragma: +optSpace }"
096ca5ceb662 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6954
diff changeset
  2894
7621
42fb582ea36b allow for blocks in assert
Claus Gittinger <cg@exept.de>
parents: 7600
diff changeset
  2895
    (aBooleanOrBlock value) ifFalse:[
8273
72c29dfc55af may proceed for assert
penk
parents: 7983
diff changeset
  2896
        self error:messageIfFailing mayProceed:true
6961
096ca5ceb662 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6954
diff changeset
  2897
    ].
096ca5ceb662 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6954
diff changeset
  2898
!
096ca5ceb662 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6954
diff changeset
  2899
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2900
basicInspect
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2901
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2902
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2903
    "launch an inspector on the receiver.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2904
     this method should NOT be redefined in subclasses."
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
    Inspector isNil ifTrue:[
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2907
        "
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2908
         for systems without GUI
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2909
        "
6926
72f1a7eb34f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6918
diff changeset
  2910
        self warn:'No Inspector defined (Inspector is nil).' 
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2911
    ] ifFalse:[
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2912
        Inspector openOn:self
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2913
    ]
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2914
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2915
    "Modified: 18.5.1996 / 15:43:25 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2916
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2917
6954
c3408e945eb5 oops - breakpoint lost
Claus Gittinger <cg@exept.de>
parents: 6950
diff changeset
  2918
breakPoint:something
c3408e945eb5 oops - breakpoint lost
Claus Gittinger <cg@exept.de>
parents: 6950
diff changeset
  2919
    "{ Pragma: +optSpace }"
c3408e945eb5 oops - breakpoint lost
Claus Gittinger <cg@exept.de>
parents: 6950
diff changeset
  2920
c3408e945eb5 oops - breakpoint lost
Claus Gittinger <cg@exept.de>
parents: 6950
diff changeset
  2921
    "Like halt, but disabled by default.
c3408e945eb5 oops - breakpoint lost
Claus Gittinger <cg@exept.de>
parents: 6950
diff changeset
  2922
     Can be easily enabled.
c3408e945eb5 oops - breakpoint lost
Claus Gittinger <cg@exept.de>
parents: 6950
diff changeset
  2923
     Can be filtered on the arguments value (typically: a symbol).
c3408e945eb5 oops - breakpoint lost
Claus Gittinger <cg@exept.de>
parents: 6950
diff changeset
  2924
     Code with breakpoints may be even checked into the source repository"
c3408e945eb5 oops - breakpoint lost
Claus Gittinger <cg@exept.de>
parents: 6950
diff changeset
  2925
c3408e945eb5 oops - breakpoint lost
Claus Gittinger <cg@exept.de>
parents: 6950
diff changeset
  2926
    "Example:   nil breakPoint:#stefan"
c3408e945eb5 oops - breakpoint lost
Claus Gittinger <cg@exept.de>
parents: 6950
diff changeset
  2927
c3408e945eb5 oops - breakpoint lost
Claus Gittinger <cg@exept.de>
parents: 6950
diff changeset
  2928
"/    something = OperatingSystem getLoginName ifTrue:[
c3408e945eb5 oops - breakpoint lost
Claus Gittinger <cg@exept.de>
parents: 6950
diff changeset
  2929
"/        ^ HaltSignal raiseRequestWith:something errorString:'Breakpoint encountered: ', something printString
c3408e945eb5 oops - breakpoint lost
Claus Gittinger <cg@exept.de>
parents: 6950
diff changeset
  2930
"/    ].
c3408e945eb5 oops - breakpoint lost
Claus Gittinger <cg@exept.de>
parents: 6950
diff changeset
  2931
c3408e945eb5 oops - breakpoint lost
Claus Gittinger <cg@exept.de>
parents: 6950
diff changeset
  2932
"/    something = 'testThis' ifTrue:[
c3408e945eb5 oops - breakpoint lost
Claus Gittinger <cg@exept.de>
parents: 6950
diff changeset
  2933
"/        ^ HaltSignal raiseRequestWith:something errorString:'Breakpoint encountered: ', something printString
c3408e945eb5 oops - breakpoint lost
Claus Gittinger <cg@exept.de>
parents: 6950
diff changeset
  2934
"/    ].
c3408e945eb5 oops - breakpoint lost
Claus Gittinger <cg@exept.de>
parents: 6950
diff changeset
  2935
!
c3408e945eb5 oops - breakpoint lost
Claus Gittinger <cg@exept.de>
parents: 6950
diff changeset
  2936
5995
21ba36ffaf3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5980
diff changeset
  2937
browse
21ba36ffaf3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5980
diff changeset
  2938
    "open a browser on the receivers class"
21ba36ffaf3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5980
diff changeset
  2939
21ba36ffaf3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5980
diff changeset
  2940
    self class theNonMetaclass browse
21ba36ffaf3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5980
diff changeset
  2941
21ba36ffaf3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5980
diff changeset
  2942
    "
21ba36ffaf3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5980
diff changeset
  2943
     10 browse
21ba36ffaf3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5980
diff changeset
  2944
     Collection browse
21ba36ffaf3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5980
diff changeset
  2945
     Collection class browse
21ba36ffaf3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5980
diff changeset
  2946
    "
21ba36ffaf3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5980
diff changeset
  2947
!
21ba36ffaf3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5980
diff changeset
  2948
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2949
inspect
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2950
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2951
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2952
    "launch an inspector on the receiver.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2953
     this method (or better: inspectorClass) can be redefined in subclasses 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2954
     to start special inspectors."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2955
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2956
    |cls|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2957
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2958
    cls := self inspectorClass.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2959
    cls isNil ifTrue:[
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2960
        ^ self basicInspect
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2961
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2962
    cls openOn:self
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2963
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2964
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2965
     Object new inspect
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2966
     (1 @ 2) inspect
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2967
     Smalltalk inspect
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2968
     #(1 2 3) asOrderedCollection inspect
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2969
     (Color red) inspect
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2970
     (Image fromFile:'bitmaps/garfield.gif') inspect
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2971
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2972
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2973
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2974
inspectorClass
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2975
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2976
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2977
    "return the class to use for inspect. 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2978
     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
  2979
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2980
    ^ Inspector
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2981
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2982
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2983
mustBeBoolean
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2984
    "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
  2985
     in an if* or while* message.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2986
     Caveat: for now, this is only sent by the interpreter;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2987
     both the JIT and the stc compiler treat it as undefined."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2988
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2989
    self error:'Non boolean receiver - proceed for truth' mayProceed:true.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2990
    ^ true
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
mustBeKindOf:aClass
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2994
    "for compatibility & debugging support: 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2995
     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
  2996
     Notice:
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2997
        it is VERY questionable, if it makes sense to add manual
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2998
        type checks to a dynamically typed language like smalltalk. 
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  2999
        It will, at least, slow down performance,
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  3000
        make your code less reusable and clutter your code with stupid sends
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  3001
        of this selector. Also, read the comment in isKindOf:, regarding the
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  3002
        use of isXXX check methods.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3003
     You see: The author does not like this at all ..."
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
    (self isKindOf:aClass) ifFalse:[
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  3006
        self error:'argument is not of expected type'
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3007
    ]
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3008
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3009
6950
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3010
obsoleteFeatureWarning
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3011
    "{ Pragma: +optSpace }"
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3012
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3013
    "in methods which are going to be changed, a send to
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3014
     this method is used to tell programmers that some feature/semantics is
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3015
     used which is going to be changed in later ST/X versions.
6963
711b3bf3b38a comments
Claus Gittinger <cg@exept.de>
parents: 6962
diff changeset
  3016
     Hopefully, this warning message is annoying enough for you to change the code... ;-)."
6950
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3017
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3018
    self obsoleteFeatureWarning:nil from:thisContext sender
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3019
!
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3020
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3021
obsoleteFeatureWarning:message
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3022
    "{ Pragma: +optSpace }"
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3023
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3024
    "in methods which are going to be changed, a send to
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3025
     this method is used to tell programmers that some feature/semantics is
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3026
     used which is going to be changed in later ST/X versions.
6963
711b3bf3b38a comments
Claus Gittinger <cg@exept.de>
parents: 6962
diff changeset
  3027
     Hopefully, this warning message is annoying enough for you to change the code... ;-).
711b3bf3b38a comments
Claus Gittinger <cg@exept.de>
parents: 6962
diff changeset
  3028
     This message is intended for application developers, so its printed as info message."
6950
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3029
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3030
    self obsoleteFeatureWarning:message from:thisContext sender
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3031
!
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3032
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3033
obsoleteFeatureWarning:message from:aContext
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3034
    "{ Pragma: +optSpace }"
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3035
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3036
    "in methods which are going to be changed, a send to
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3037
     this method is used to tell programmers that some feature/semantics is
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3038
     used which is going to be changed in later ST/X versions.
6963
711b3bf3b38a comments
Claus Gittinger <cg@exept.de>
parents: 6962
diff changeset
  3039
     Hopefully, this warning message is annoying enough for you to change the code... ;-).
711b3bf3b38a comments
Claus Gittinger <cg@exept.de>
parents: 6962
diff changeset
  3040
     This message is intended for application developers, so its printed as info message."
6950
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3041
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3042
    |spec|
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3043
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3044
    spec := aContext methodPrintString.
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3045
    ('WARNING: the ''' , spec , ''' semantics will be changed.') infoPrintCR.
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3046
    ('         Its behavior may be different in future ST/X versions.') infoPrintCR.
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3047
    ('         called from ' , aContext sender printString) infoPrintCR.
7204
e968d9923408 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 7202
diff changeset
  3048
    (aContext sender selector startsWith:'perform:') ifTrue:[
e968d9923408 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 7202
diff changeset
  3049
    ('         called from ' , aContext sender sender printString) infoPrintCR.
e968d9923408 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 7202
diff changeset
  3050
    ].
6950
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3051
    message notNil ifTrue:[
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3052
        '------>  ' infoPrint. message infoPrintCR
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3053
    ]
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3054
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3055
    "
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3056
     Object obsoleteFeatureWarning:'foo' from:thisContext sender sender
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3057
    "
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3058
!
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3059
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3060
obsoleteMethodWarning
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3061
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3062
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3063
    "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
  3064
     this method is used to tell programmers that a method is
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3065
     used which is going to be removed in later ST/X versions.
6963
711b3bf3b38a comments
Claus Gittinger <cg@exept.de>
parents: 6962
diff changeset
  3066
     Find all methods which will be obsolete soon by looking at senders of this message.
711b3bf3b38a comments
Claus Gittinger <cg@exept.de>
parents: 6962
diff changeset
  3067
     Hopefully, this warning message is annoying enough for you to change the code... ;-)"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3068
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3069
    self obsoleteMethodWarning:nil from:thisContext sender
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3070
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3071
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3072
obsoleteMethodWarning:message
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3073
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3074
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3075
    "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
  3076
     this method is used to tell programmers that a method is
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3077
     used which is going to be removed in later ST/X versions.
6963
711b3bf3b38a comments
Claus Gittinger <cg@exept.de>
parents: 6962
diff changeset
  3078
     Find all methods which will be obsolete soon by looking at senders of this message.
711b3bf3b38a comments
Claus Gittinger <cg@exept.de>
parents: 6962
diff changeset
  3079
     Hopefully, this warning message is annoying enough for you to change the code... ;-)"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3080
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3081
    self obsoleteMethodWarning:message from:thisContext sender
8829
9e640b6c0679 No obsolete messages in standalone apps
Stefan Vogel <sv@exept.de>
parents: 8827
diff changeset
  3082
!
9e640b6c0679 No obsolete messages in standalone apps
Stefan Vogel <sv@exept.de>
parents: 8827
diff changeset
  3083
9e640b6c0679 No obsolete messages in standalone apps
Stefan Vogel <sv@exept.de>
parents: 8827
diff changeset
  3084
obsoleteMethodWarning:message from:aContext
9e640b6c0679 No obsolete messages in standalone apps
Stefan Vogel <sv@exept.de>
parents: 8827
diff changeset
  3085
    "{ Pragma: +optSpace }"
9e640b6c0679 No obsolete messages in standalone apps
Stefan Vogel <sv@exept.de>
parents: 8827
diff changeset
  3086
9e640b6c0679 No obsolete messages in standalone apps
Stefan Vogel <sv@exept.de>
parents: 8827
diff changeset
  3087
    "in methods which are going to be obsoleted, a self-send to
9e640b6c0679 No obsolete messages in standalone apps
Stefan Vogel <sv@exept.de>
parents: 8827
diff changeset
  3088
     this method is used to tell programmers that a method is
9e640b6c0679 No obsolete messages in standalone apps
Stefan Vogel <sv@exept.de>
parents: 8827
diff changeset
  3089
     used which is going to be removed in later ST/X versions.
9e640b6c0679 No obsolete messages in standalone apps
Stefan Vogel <sv@exept.de>
parents: 8827
diff changeset
  3090
     Find all methods which will be obsolete soon by looking at senders of this message.
9e640b6c0679 No obsolete messages in standalone apps
Stefan Vogel <sv@exept.de>
parents: 8827
diff changeset
  3091
     Hopefully, this warning message is annoying enough for you to change the code... ;-).
9e640b6c0679 No obsolete messages in standalone apps
Stefan Vogel <sv@exept.de>
parents: 8827
diff changeset
  3092
     This message is intended for application developers, so its printed as info message."
9e640b6c0679 No obsolete messages in standalone apps
Stefan Vogel <sv@exept.de>
parents: 8827
diff changeset
  3093
9e640b6c0679 No obsolete messages in standalone apps
Stefan Vogel <sv@exept.de>
parents: 8827
diff changeset
  3094
    |spec sender|
9e640b6c0679 No obsolete messages in standalone apps
Stefan Vogel <sv@exept.de>
parents: 8827
diff changeset
  3095
9509
bfb55a08130d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9442
diff changeset
  3096
    Smalltalk isSmalltalkDevelopmentSystem ifFalse:[
8829
9e640b6c0679 No obsolete messages in standalone apps
Stefan Vogel <sv@exept.de>
parents: 8827
diff changeset
  3097
        "ignore in production systems"
9e640b6c0679 No obsolete messages in standalone apps
Stefan Vogel <sv@exept.de>
parents: 8827
diff changeset
  3098
        ^ self.
9e640b6c0679 No obsolete messages in standalone apps
Stefan Vogel <sv@exept.de>
parents: 8827
diff changeset
  3099
    ].
9e640b6c0679 No obsolete messages in standalone apps
Stefan Vogel <sv@exept.de>
parents: 8827
diff changeset
  3100
9e640b6c0679 No obsolete messages in standalone apps
Stefan Vogel <sv@exept.de>
parents: 8827
diff changeset
  3101
    spec := aContext methodPrintString.
9e640b6c0679 No obsolete messages in standalone apps
Stefan Vogel <sv@exept.de>
parents: 8827
diff changeset
  3102
    sender := aContext sender.
9e640b6c0679 No obsolete messages in standalone apps
Stefan Vogel <sv@exept.de>
parents: 8827
diff changeset
  3103
    ('WARNING: the ''' , spec , ''' method is obsolete.') infoPrintCR.
9e640b6c0679 No obsolete messages in standalone apps
Stefan Vogel <sv@exept.de>
parents: 8827
diff changeset
  3104
    ('         And may not be present in future ST/X versions.') infoPrintCR.
9e640b6c0679 No obsolete messages in standalone apps
Stefan Vogel <sv@exept.de>
parents: 8827
diff changeset
  3105
    ('         called from ' , sender printString) infoPrintCR.
9e640b6c0679 No obsolete messages in standalone apps
Stefan Vogel <sv@exept.de>
parents: 8827
diff changeset
  3106
    (sender selector startsWith:'perform:') ifTrue:[
9e640b6c0679 No obsolete messages in standalone apps
Stefan Vogel <sv@exept.de>
parents: 8827
diff changeset
  3107
        sender := sender sender.
9e640b6c0679 No obsolete messages in standalone apps
Stefan Vogel <sv@exept.de>
parents: 8827
diff changeset
  3108
        (sender selector startsWith:'perform:') ifTrue:[
9e640b6c0679 No obsolete messages in standalone apps
Stefan Vogel <sv@exept.de>
parents: 8827
diff changeset
  3109
            sender := sender sender.
9e640b6c0679 No obsolete messages in standalone apps
Stefan Vogel <sv@exept.de>
parents: 8827
diff changeset
  3110
        ].
9e640b6c0679 No obsolete messages in standalone apps
Stefan Vogel <sv@exept.de>
parents: 8827
diff changeset
  3111
        ('         called from ' , sender printString) infoPrintCR.
9e640b6c0679 No obsolete messages in standalone apps
Stefan Vogel <sv@exept.de>
parents: 8827
diff changeset
  3112
    ].
9e640b6c0679 No obsolete messages in standalone apps
Stefan Vogel <sv@exept.de>
parents: 8827
diff changeset
  3113
    message notNil ifTrue:[
9e640b6c0679 No obsolete messages in standalone apps
Stefan Vogel <sv@exept.de>
parents: 8827
diff changeset
  3114
        '------>  ' infoPrint. message infoPrintCR
9e640b6c0679 No obsolete messages in standalone apps
Stefan Vogel <sv@exept.de>
parents: 8827
diff changeset
  3115
    ]
9e640b6c0679 No obsolete messages in standalone apps
Stefan Vogel <sv@exept.de>
parents: 8827
diff changeset
  3116
9e640b6c0679 No obsolete messages in standalone apps
Stefan Vogel <sv@exept.de>
parents: 8827
diff changeset
  3117
    "
9e640b6c0679 No obsolete messages in standalone apps
Stefan Vogel <sv@exept.de>
parents: 8827
diff changeset
  3118
     Object obsoleteMethodWarning:'foo' from:thisContext sender sender
9e640b6c0679 No obsolete messages in standalone apps
Stefan Vogel <sv@exept.de>
parents: 8827
diff changeset
  3119
    "
9509
bfb55a08130d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9442
diff changeset
  3120
bfb55a08130d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9442
diff changeset
  3121
    "Modified: / 10-08-2006 / 13:13:11 / cg"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3122
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3123
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3124
!Object methodsFor:'dependents access'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3125
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3126
addDependent:anObject
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3127
    "make the argument, anObject be a dependent of the receiver"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3128
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3129
    |wasBlocked|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3130
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3131
    "/ must do this save from interrupts, since the dependents collection
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3132
    "/ is possibly accessed from multiple threads.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3133
    "/ Used to use #valueUninterruptably here; inlined that code for slightly
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3134
    "/ faster execution.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3135
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3136
    wasBlocked := OperatingSystem blockInterrupts.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3137
    [
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  3138
        |deps dep|
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  3139
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  3140
        deps := self dependents.
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  3141
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  3142
        "/ to save a fair amount of memory in case of
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  3143
        "/ many dependencies, we store a single dependent in
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  3144
        "/ a WeakArray, and switch to a WeakSet if more dependents are
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  3145
        "/ added.
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  3146
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  3147
        (deps isNil or:[deps size == 0]) ifTrue:[
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  3148
            self dependents:(WeakArray with:anObject)
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  3149
        ] ifFalse:[
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  3150
            deps class == WeakArray ifTrue:[
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  3151
                dep := deps at:1.
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  3152
                dep ~~ anObject ifTrue:[
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  3153
                    (dep isNil or:[dep == 0]) ifTrue:[
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  3154
                        deps at:1 put:anObject
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  3155
                    ] ifFalse:[
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  3156
                        self dependents:(WeakIdentitySet with:dep with:anObject)
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  3157
                    ]
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  3158
                ]
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  3159
            ] ifFalse:[
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  3160
                deps add:anObject
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  3161
            ]
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  3162
        ]
6421
58dca33cf0fc #valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents: 6418
diff changeset
  3163
    ] ensure:[
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  3164
        wasBlocked ifFalse:[
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  3165
            OperatingSystem unblockInterrupts
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  3166
        ]
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3167
    ]
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3168
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3169
    "Modified: / 27.10.1997 / 19:35:52 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3170
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3171
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3172
breakDependents
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3173
    "remove all dependencies from the receiver"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3174
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3175
    self dependents:nil.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3176
    self nonWeakDependents:nil
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3177
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3178
    "Modified: / 19.4.1996 / 10:55:36 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3179
    "Created: / 27.2.1998 / 11:26:11 / stefan"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3180
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3181
8542
38f9d04fe40a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8521
diff changeset
  3182
breakDependentsRecursively
38f9d04fe40a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8521
diff changeset
  3183
    "remove all dependencies from the receiver and 
38f9d04fe40a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8521
diff changeset
  3184
     recursively from all objects referred to by the receiver."
38f9d04fe40a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8521
diff changeset
  3185
38f9d04fe40a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8521
diff changeset
  3186
    self breakDependents.
38f9d04fe40a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8521
diff changeset
  3187
    1 to:self class instSize do:[:idx | 
38f9d04fe40a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8521
diff changeset
  3188
        (self instVarAt:idx) breakDependentsRecursively.
38f9d04fe40a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8521
diff changeset
  3189
    ].
38f9d04fe40a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8521
diff changeset
  3190
    1 to:self basicSize do:[:idx | 
38f9d04fe40a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8521
diff changeset
  3191
        (self basicAt:idx) breakDependentsRecursively.
38f9d04fe40a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8521
diff changeset
  3192
    ]
38f9d04fe40a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8521
diff changeset
  3193
!
38f9d04fe40a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8521
diff changeset
  3194
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3195
dependents
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3196
    "return a Collection of dependents.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3197
     The default implementation here uses a global WeakDictionary to store
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3198
     dependents 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3199
     This may be too slow for high frequency change&update,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3200
     therefore, some classes (Model) redefine this for better performance.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3201
     Notice the mentioning of a WeakDictionary - read the classes documentation."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3202
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3203
    |deps|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3204
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3205
    (deps := Dependencies at:self ifAbsent:nil) isNil ifTrue:[
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  3206
        ^ #().
5755
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
    ^ deps
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3209
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3210
    "Modified: / 26.1.1998 / 11:18:15 / cg"
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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3213
dependents:aCollection
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3214
    "set the collection of dependents.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3215
     The default implementation here uses a global Dictionary to store
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3216
     dependents which may be too slow for high frequency change&update.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3217
     Therefore, some classes (Model) redefine this for better performance."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3218
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3219
    "/ must do this save from interrupts, since the dependents collection
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3220
    "/ is possibly accessed from multiple threads.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3221
    "/ Used to use #valueUninterruptably here; inlined that code for slightly
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3222
    "/ faster execution (and to avoid creation of garbage blocks).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3223
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3224
    (OperatingSystem blockInterrupts) ifTrue:[
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  3225
        "/ the common case - already blocked
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  3226
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  3227
        (aCollection isNil or:[aCollection isEmpty]) ifTrue:[
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  3228
            Dependencies removeKey:self ifAbsent:nil
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  3229
        ] ifFalse:[
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  3230
            Dependencies at:self put:aCollection
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  3231
        ].
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  3232
        ^ self
5755
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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3235
    [
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  3236
        (aCollection isNil or:[aCollection isEmpty]) ifTrue:[
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  3237
            Dependencies removeKey:self ifAbsent:nil
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  3238
        ] ifFalse:[
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  3239
            Dependencies at:self put:aCollection
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  3240
        ].
6421
58dca33cf0fc #valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents: 6418
diff changeset
  3241
    ] ensure:[
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  3242
        OperatingSystem unblockInterrupts
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3243
    ]
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3244
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3245
    "Modified: 30.1.1997 / 21:22:10 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3246
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3247
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3248
dependentsDo:aBlock
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3249
    "evaluate aBlock for all of my dependents"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3250
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3251
    |deps nwDeps|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3252
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3253
    deps := self dependents.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3254
    deps size ~~ 0 ifTrue:[
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  3255
        deps do:[:d | 
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  3256
                    (d notNil and:[d ~~ 0]) ifTrue:[
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  3257
                        aBlock value:d
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  3258
                    ]
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  3259
                ]
5755
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
    nwDeps := self nonWeakDependents.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3262
    (nwDeps ~~ deps and:[nwDeps size ~~ 0]) ifTrue:[
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  3263
        nwDeps do:aBlock 
5755
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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3266
    "Modified: / 30.1.1998 / 14:03:40 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3267
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3268
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3269
myDependents
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3270
    "same as dependents - ST-80 compatibility"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3271
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3272
    ^ self dependents
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3273
!
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
release
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3276
    "remove all references to objects that may refer to self.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3277
     Subclasses may redefine this method but should do a 'super release'."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3278
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3279
    self breakDependents
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3280
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3281
    "Modified: / 27.2.1998 / 11:29:35 / stefan"
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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3284
removeDependent:anObject
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3285
    "make the argument, anObject be independent of the receiver"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3286
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3287
    |wasBlocked|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3288
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3289
    "/ must do this save from interrupts, since the dependents collection
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3290
    "/ is possibly accessed from multiple threads.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3291
    "/ Used to use #valueUninterruptably here; inlined that code for slightly
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3292
    "/ faster execution.
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
    wasBlocked := OperatingSystem blockInterrupts.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3295
    [
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  3296
        |deps n d|
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  3297
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  3298
        deps := self dependents.
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  3299
        deps size ~~ 0 ifTrue:[
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  3300
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  3301
            "/ to save a fair amount of memory in case of
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  3302
            "/ many dependencies, we store a single dependent in
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  3303
            "/ a WeakArray, and switch to a WeakSet if more dependents are
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  3304
            "/ added. Here we have to do the inverse ...
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  3305
9240
271ab8ebb7de *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9221
diff changeset
  3306
            ((deps class == WeakArray) or:[deps class == Array]) ifTrue:[
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  3307
                ((d := deps at:1) == anObject 
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  3308
                or:[d isNil
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  3309
                or:[d == 0]]) ifTrue:[
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  3310
                    self dependents:nil
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  3311
                ]
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  3312
            ] ifFalse:[
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  3313
                deps remove:anObject ifAbsent:[].
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  3314
                (n := deps size) == 0 ifTrue:[
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  3315
                    self dependents:nil
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  3316
                ] ifFalse:[
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  3317
                    n == 1 ifTrue:[
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  3318
                        d := deps firstIfEmpty:nil.
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  3319
                        d notNil ifTrue:[
9246
601ed6b6b95d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9240
diff changeset
  3320
                            deps := (deps isWeakCollection ifTrue:WeakArray ifFalse:Array) with:d
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  3321
                        ] ifFalse:[
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  3322
                            deps := nil
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  3323
                        ].
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  3324
                        self dependents:deps.
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  3325
                    ]
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  3326
                ]
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  3327
            ]
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  3328
        ]
6421
58dca33cf0fc #valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents: 6418
diff changeset
  3329
    ] ensure:[
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  3330
        wasBlocked ifFalse:[
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  3331
            OperatingSystem unblockInterrupts
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  3332
        ]
5755
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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3335
    "Modified: / 26.1.1998 / 19:51:50 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3336
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3337
7266
f2b64d3b43cf method category rename
Claus Gittinger <cg@exept.de>
parents: 7261
diff changeset
  3338
!Object methodsFor:'dependents access (non weak)'!
5755
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
addNonWeakDependent:anObject
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3341
    "make the argument, anObject be a nonWeak dependent of the receiver.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3342
     Be careful: this nonWeakDependency will prevent the dependent from being 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3343
     garbage collected unless the dependency is removed.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3344
     This is a private mechanism, for directed dependencies."
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
    |wasBlocked|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3347
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3348
    "/ must do this save from interrupts, since the dependents collection
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3349
    "/ is possibly accessed from multiple threads.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3350
    "/ Used to use #valueUninterruptably here; inlined that code for slightly
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3351
    "/ faster execution.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3352
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3353
    wasBlocked := OperatingSystem blockInterrupts.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3354
    [
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  3355
        |deps dep|
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  3356
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  3357
        deps := self nonWeakDependents.
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  3358
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  3359
        "/ to save a fair amount of memory in case of
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  3360
        "/ many dependencies, we store a single dependent in
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  3361
        "/ an Array, and switch to a Set if more dependents are
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  3362
        "/ added.
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  3363
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  3364
        deps size == 0 ifTrue:[
9442
f564054eaf6a do not add nil as dependent
Stefan Vogel <sv@exept.de>
parents: 9405
diff changeset
  3365
            anObject notNil ifTrue:[
f564054eaf6a do not add nil as dependent
Stefan Vogel <sv@exept.de>
parents: 9405
diff changeset
  3366
                self nonWeakDependents:(Array with:anObject).
f564054eaf6a do not add nil as dependent
Stefan Vogel <sv@exept.de>
parents: 9405
diff changeset
  3367
            ] ifFalse:[
f564054eaf6a do not add nil as dependent
Stefan Vogel <sv@exept.de>
parents: 9405
diff changeset
  3368
                "adding nil causes problems when adding the next one 
f564054eaf6a do not add nil as dependent
Stefan Vogel <sv@exept.de>
parents: 9405
diff changeset
  3369
                 (see below: trying to add nil to IdentitySet)"
f564054eaf6a do not add nil as dependent
Stefan Vogel <sv@exept.de>
parents: 9405
diff changeset
  3370
"/                self halt:'try to add nil to list of dependents'.
f564054eaf6a do not add nil as dependent
Stefan Vogel <sv@exept.de>
parents: 9405
diff changeset
  3371
            ].
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  3372
        ] ifFalse:[
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  3373
            deps class == Array ifTrue:[
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  3374
                dep := deps at:1.
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  3375
                dep ~~ anObject ifTrue:[
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  3376
                    self nonWeakDependents:(IdentitySet with:dep with:anObject)
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  3377
                ]
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  3378
            ] ifFalse:[
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  3379
                deps add:anObject
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  3380
            ]
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  3381
        ]
6421
58dca33cf0fc #valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents: 6418
diff changeset
  3382
    ] ensure:[
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  3383
        wasBlocked ifFalse:[
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  3384
            OperatingSystem unblockInterrupts
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  3385
        ]
5755
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
    "Created: / 19.4.1996 / 10:54:08 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3389
    "Modified: / 30.1.1998 / 14:03:08 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3390
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3391
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3392
nonWeakDependents
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3393
    "return a Collection of nonWeakDependents - empty if there is none.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3394
     This is a private mechanism for directed dependencies."
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
    NonWeakDependencies isNil ifTrue:[^ #()].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3397
    ^ NonWeakDependencies at:self ifAbsent:#()
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3398
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3399
    "Created: / 19.4.1996 / 10:55:06 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3400
    "Modified: / 30.1.1998 / 14:06:47 / cg"
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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3403
nonWeakDependents:aCollection
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3404
    "set the collection of nonWeak dependents.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3405
     This is a private helper for directed dependencies."
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
    [
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  3408
        (aCollection isNil or:[aCollection isEmpty]) ifTrue:[
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  3409
            NonWeakDependencies removeKey:self ifAbsent:nil
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  3410
        ] ifFalse:[
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  3411
            NonWeakDependencies at:self put:aCollection
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  3412
        ]
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3413
    ] valueUninterruptably
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3414
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3415
    "Created: 19.4.1996 / 11:07:47 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3416
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3417
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3418
removeNonWeakDependent:anObject
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3419
    "remove a nonWeak dependency from the receiver to the argument, anObject.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3420
     (i.e. make it independent of the receiver)"
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
    |wasBlocked|
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
    "/ must do this save from interrupts, since the dependents collection
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3425
    "/ is possibly accessed from multiple threads.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3426
    "/ Used to use #valueUninterruptably here; inlined that code for slightly
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3427
    "/ faster execution.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3428
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3429
    wasBlocked := OperatingSystem blockInterrupts.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3430
    [
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  3431
        |deps n|
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  3432
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  3433
        deps := self nonWeakDependents.
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  3434
        deps size ~~ 0 ifTrue:[
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  3435
            deps class == Array ifTrue:[
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  3436
                (deps at:1) == anObject ifTrue:[
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  3437
                    self nonWeakDependents:nil
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  3438
                ]
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  3439
            ] ifFalse:[
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  3440
                deps remove:anObject ifAbsent:[].
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  3441
                (n := deps size) == 0 ifTrue:[
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  3442
                    self nonWeakDependents:nil
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  3443
                ] ifFalse:[
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  3444
                    n == 1 ifTrue:[
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  3445
                        self nonWeakDependents:(Array with:(deps first))
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  3446
                    ]
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  3447
                ]
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  3448
            ]
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  3449
        ]
6421
58dca33cf0fc #valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents: 6418
diff changeset
  3450
    ] ensure:[
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  3451
        wasBlocked ifFalse:[
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  3452
            OperatingSystem unblockInterrupts
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  3453
        ]
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3454
    ]
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3455
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3456
    "Created: / 19.4.1996 / 11:44:44 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3457
    "Modified: / 30.1.1998 / 14:04:01 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3458
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3459
9279
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3460
!Object methodsFor:'dependents-interests'!
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3461
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3462
addInterest:anInterest
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3463
    "install an interest forwarder.
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3464
     Here, we use the nonWeakDependencies."
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3465
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3466
    self addNonWeakDependent:anInterest
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3467
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3468
    "Created: 14.10.1996 / 22:27:34 / stefan"
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3469
!
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3470
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3471
expressInterestIn:aspect for:anObject sendBack:aSelector
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3472
    "arrange for aSelector to be sent to anObject whenever the receiver
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3473
     changes aspect."
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3474
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3475
    "/ for now, use an interestConverter, which is somewhat less efficient.
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3476
    "/ In the future, a more intelligent DependencyCollection class is planned for
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3477
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3478
    self addInterest:(InterestConverter 
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3479
                            destination:anObject 
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3480
                            selector:aSelector 
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3481
                            aspect:aspect)
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3482
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3483
    "
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3484
     |p b|
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3485
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3486
     b := [Transcript showCR:' -> the point changed'].
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3487
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3488
     p := Point new.
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3489
     Transcript showCR:'interest in #foo:'.
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3490
     p expressInterestIn:#foo for:b sendBack:#value.
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3491
     p x:1.
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3492
     Transcript showCR:'now changing #bar ... (expect no notification)'.
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3493
     p changed:#bar.
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3494
     Transcript cr.
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3495
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3496
     Delay waitForSeconds:1.
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3497
     Transcript showCR:'now changing #foo ... (expect notification)'.
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3498
     p changed:#foo.
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3499
     Transcript cr.
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3500
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3501
     Delay waitForSeconds:1.
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3502
     Transcript showCR:'no more interest in #foo:'.
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3503
     p retractInterestIn:#foo for:b.
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3504
     Transcript showCR:'now changing #foo ... (expect no notification)'.
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3505
     p changed:#foo.
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3506
     Transcript cr.
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3507
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3508
     Delay waitForSeconds:1.
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3509
     Transcript showCR:'interest in #bar now:'.
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3510
     p expressInterestIn:#bar for:b sendBack:#value.
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3511
     Transcript showCR:'now changing #foo ... (expect no notification)'.
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3512
     p changed:#foo.
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3513
     Transcript showCR:'now changing #bar ... (expect notification)'.
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3514
     p changed:#bar.
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3515
     Transcript cr.
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3516
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3517
     Delay waitForSeconds:1.
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3518
     Transcript showCR:'interest in #foo now:'.
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3519
     p expressInterestIn:#foo for:b sendBack:#value.
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3520
     Transcript showCR:'now changing #foo ... (expect notification)'.
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3521
     p changed:#foo.
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3522
     Transcript showCR:'now changing #bar ... (expect notification)'.
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3523
     p changed:#bar.
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3524
     Transcript cr.
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3525
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3526
     Delay waitForSeconds:1.
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3527
     Transcript showCR:'no more interests:'.
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3528
     p retractInterestsFor:b.
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3529
     Transcript showCR:'now changing #foo ... (expect no notification)'.
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3530
     p changed:#foo.
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3531
     Transcript showCR:'now changing #bar...  (expect no notification)'.
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3532
     p changed:#bar.
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3533
     Transcript cr.
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3534
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3535
     p release.
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3536
    "
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3537
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3538
    "Created: 19.4.1996 / 10:26:22 / cg"
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3539
    "Modified: 19.4.1996 / 12:34:08 / cg"
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3540
    "Modified: 14.10.1996 / 22:28:20 / stefan"
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3541
!
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3542
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3543
interests
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3544
    "return a Collection of interests - empty if there is none.
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3545
     Here, we use the nonWeakDependents for interests."
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3546
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3547
    ^ self nonWeakDependents
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3548
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3549
    "Created: / 14.10.1996 / 22:20:51 / stefan"
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3550
    "Modified: / 30.1.1998 / 14:07:35 / cg"
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3551
!
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3552
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3553
interestsFor:someOne
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3554
    "return a collection of interests of someOne - empty if there is none."
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3555
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3556
    |coll deps|
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3557
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3558
    deps := self interests.
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3559
    deps size == 0 ifTrue:[^ #()].
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3560
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3561
    coll := IdentitySet new.
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3562
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3563
    deps do:[:dep |
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3564
        (dep isInterestConverter) ifTrue:[
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3565
            dep destination == someOne ifTrue:[
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3566
                coll add:dep.
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3567
            ]
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3568
        ]
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3569
    ].
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3570
    ^ coll
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3571
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3572
    "Created: / 30.1.1998 / 14:02:26 / cg"
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3573
    "Modified: / 30.1.1998 / 14:08:24 / cg"
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3574
!
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3575
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3576
onChangeEvaluate:aBlock
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3577
    "arrange for aBlock to be evaluated whenever the receiver changes."
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3578
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3579
    ^ self onChangeSend:#value to:aBlock
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3580
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3581
    "
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3582
     |p b|
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3583
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3584
     b := [Transcript showCR:' -> the point changed'].
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3585
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3586
     p := Point new.
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3587
     Transcript showCR:'interest in #foo:'.
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3588
     p onChangeEvaluate:b.
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3589
     p x:1.
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3590
     Transcript showCR:'now changing #bar ... (expect no notification)'.
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3591
     p changed:#bar.
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3592
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3593
     p retractInterests.
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3594
     p changed:#bar.
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3595
    "
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3596
!
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3597
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3598
onChangeSend:aSelector to:anObject
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3599
    "arrange for aSelector to be sent to anObject whenever the receiver
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3600
     changes."
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3601
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3602
    "/ for now, use an interestConverter, which is somewhat less efficient.
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3603
    "/ In the future, a more intelligent DependencyCollection class is planned for
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3604
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3605
    ((self interests ? #())
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3606
        contains:[:anInterest |
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3607
            (anInterest isInterestConverter)
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3608
            and:[ anInterest destination == anObject
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3609
            and:[ anInterest selector == aSelector]]
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3610
        ])
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3611
            ifTrue:[^ self].
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3612
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3613
    self addInterest:(InterestConverter 
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3614
                          destination:anObject 
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3615
                          selector:aSelector)
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3616
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3617
    "
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3618
     |p b|
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3619
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3620
     b := [Transcript showCR:'the point changed'].
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3621
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3622
     p := Point new.
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3623
     p onChangeSend:#value to:b.
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3624
     p x:1.
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3625
     Transcript showCR:'now changing'.
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3626
     p changed.
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3627
     Transcript cr.
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3628
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3629
     Delay waitForSeconds:1.
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3630
     Transcript showCR:'now changing'.
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3631
     p changed.
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3632
     Transcript cr.
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3633
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3634
     Delay waitForSeconds:1.
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3635
     Transcript showCR:'no more interest'.
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3636
     p retractInterestsFor:b.
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3637
     Transcript showCR:'now changing again'.
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3638
     p changed.
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3639
     Transcript cr.
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3640
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3641
     Delay waitForSeconds:1.
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3642
     Transcript showCR:'interest again'.
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3643
     p onChangeSend:#value to:b.
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3644
     Transcript showCR:'now changing again'.
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3645
     p changed.
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3646
     Transcript cr.
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3647
    "
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3648
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3649
    "Created: 19.4.1996 / 10:26:38 / cg"
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3650
    "Modified: 19.4.1996 / 12:34:26 / cg"
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3651
    "Modified: 14.10.1996 / 22:28:27 / stefan"
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3652
!
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3653
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3654
removeInterest:anInterest
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3655
    "remove an interest forwarder.
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3656
     Here, we use the nonWeakDependencies."
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3657
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3658
    self removeNonWeakDependent:anInterest
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3659
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3660
    "Created: 14.10.1996 / 22:21:59 / stefan"
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3661
!
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3662
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3663
retractInterestIn:aspect for:someOne
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3664
    "remove the interest of someOne in the receiver changing aspect
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3665
     (as installed with #expressInterestIn:for:sendBack:)."
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3666
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3667
    "/ for now, remove the interestConverter.
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3668
    "/ In the future, a more intelligent DependencyCollection class is planned for
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3669
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3670
    self retractInterestsForWhich:[:i | (i aspect == aspect) and:[i destination == someOne]]
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3671
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3672
    "
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3673
     |p b|
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3674
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3675
     b := [Transcript showCR:'the point changed'].
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3676
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3677
     p := Point new.
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3678
     Transcript showCR:'interest in #foo'.
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3679
     p expressInterestIn:#foo for:b sendBack:#value.
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3680
     p x:1.
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3681
     Transcript showCR:'now changing #bar'.
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3682
     p changed:#bar.
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3683
     Transcript cr.
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3684
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3685
     Delay waitForSeconds:1.
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3686
     Transcript showCR:'now changing #foo'.
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3687
     p changed:#foo.
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3688
     Transcript cr.
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3689
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3690
     Delay waitForSeconds:1.
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3691
     Transcript showCR:'no more interest in #foo'.
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3692
     p retractInterestIn:#foo for:b.
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3693
     Transcript showCR:'now changing #foo'.
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3694
     p changed:#foo.
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3695
     Transcript cr.
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3696
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3697
     Delay waitForSeconds:1.
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3698
     Transcript showCR:'interest in #bar now'.
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3699
     p expressInterestIn:#bar for:b sendBack:#value.
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3700
     Transcript showCR:'now changing #foo'.
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3701
     p changed:#foo.
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3702
     Transcript showCR:'now changing #bar'.
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3703
     p changed:#bar.
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3704
     Transcript cr.
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3705
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3706
     Delay waitForSeconds:1.
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3707
     Transcript showCR:'interest in #foo now'.
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3708
     p expressInterestIn:#foo for:b sendBack:#value.
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3709
     Transcript showCR:'now changing #foo'.
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3710
     p changed:#foo.
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3711
     Transcript showCR:'now changing #bar'.
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3712
     p changed:#bar.
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3713
     Transcript cr.
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3714
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3715
     Delay waitForSeconds:1.
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3716
     Transcript showCR:'no more interests'.
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3717
     p retractInterestsFor:b.
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3718
     Transcript showCR:'now changing #foo'.
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3719
     p changed:#foo.
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3720
     Transcript showCR:'now changing #bar'.
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3721
     p changed:#bar.
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3722
     Transcript cr.
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3723
    "
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3724
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3725
    "Created: / 19.4.1996 / 10:27:11 / cg"
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3726
    "Modified: / 14.10.1996 / 22:21:19 / stefan"
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3727
    "Modified: / 30.1.1998 / 14:05:34 / cg"
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3728
!
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3729
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3730
retractInterests
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3731
    "remove all interests in the receiver changing aspect
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3732
     (as installed with #expressInterestIn:for:sendBack:)."
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3733
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3734
    "/ for now, remove the interestConverter.
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3735
    "/ In the future, a more intelligent DependencyCollection class is planned for
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3736
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3737
    self retractInterestsForWhich:[:i | true ]
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3738
!
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3739
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3740
retractInterestsFor:someOne
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3741
    "remove the interest of someOne in the receiver 
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3742
     (as installed with #onChangeSend:to:)."
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3743
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3744
    "/ for now, remove the interestConverter.
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3745
    "/ In the future, a more intelligent DependencyCollection class is planned for
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3746
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3747
    self retractInterestsForWhich:[:i | i destination == someOne ]
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3748
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3749
    "
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3750
     |p b|
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3751
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3752
     b := [Transcript showCR:'the point changed'].
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3753
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3754
     p := Point new.
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3755
     p onChangeSend:#value to:b.
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3756
     p x:1.
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3757
     Transcript showCR:'now changing'.
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3758
     p changed.
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3759
     Transcript cr.
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3760
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3761
     Delay waitForSeconds:1.
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3762
     Transcript showCR:'now changing'.
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3763
     p changed.
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3764
     Transcript cr.
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3765
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3766
     Delay waitForSeconds:1.
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3767
     Transcript showCR:'no more interest'.
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3768
     p retractInterestsFor:b.
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3769
     Transcript showCR:'now changing again'.
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3770
     p changed.
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3771
     Transcript cr.
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3772
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3773
     Delay waitForSeconds:1.
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3774
     Transcript showCR:'interest again'.
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3775
     p onChangeSend:#value to:b.
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3776
     Transcript showCR:'now changing again'.
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3777
     p changed.
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3778
     Transcript cr.
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3779
    "
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3780
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3781
    "Created: / 19.4.1996 / 10:23:46 / cg"
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3782
    "Modified: / 14.10.1996 / 22:21:25 / stefan"
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3783
    "Modified: / 30.1.1998 / 14:04:52 / cg"
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3784
!
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3785
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3786
retractInterestsForWhich:aBlock
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3787
    "remove all interests in the receiver changing aspect
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3788
     (as installed with #expressInterestIn:for:sendBack:)."
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3789
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3790
    "/ for now, remove the interestConverter.
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3791
    "/ In the future, a more intelligent DependencyCollection class is planned for
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3792
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3793
    |deps coll|
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3794
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3795
    deps := self interests.
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3796
    deps size ~~ 0 ifTrue:[
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3797
        "/ cannot removeDependent within the loop - the interests collection rehashes
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3798
        coll := OrderedCollection new.
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3799
        deps do:[:dep |
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3800
            dep isInterestConverter ifTrue:[
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3801
                (aBlock value:dep) ifTrue:[coll add:dep].
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3802
            ]
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3803
        ].
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3804
        coll do:[:dep |
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3805
            self removeInterest:dep.
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3806
        ].
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3807
    ].
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3808
!
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3809
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3810
retractInterestsIn:aspect
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3811
    "remove all interests in the receiver changing aspect
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3812
     (as installed with #expressInterestIn:for:sendBack:)."
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3813
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3814
    "/ for now, remove the interestConverter.
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3815
    "/ In the future, a more intelligent DependencyCollection class is planned for
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3816
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3817
    self retractInterestsForWhich:[:i | i aspect == aspect ]
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3818
! !
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3819
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3820
!Object methodsFor:'dependents-st/v event simulation'!
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3821
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3822
removeActionsForEvent:eventName
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3823
    "remove ST/V-style event triggers."
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3824
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3825
    self retractInterestsIn:eventName
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3826
!
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3827
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3828
removeAllActionsWithReceiver:anObject
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3829
    "remove ST/V-style event triggers."
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3830
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3831
    self retractInterestsFor:anObject
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3832
!
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3833
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3834
triggerEvent:eventSymbol withArguments:parameters
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3835
    "perform ST/V-style event triggering."
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3836
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3837
    self changed:eventSymbol with:parameters.
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3838
!
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3839
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3840
when:eventSymbol send:selector to:anObject
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3841
    "install an ST/V-style interest forwarder.
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3842
     Here, we use the nonWeakDependencies."
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3843
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3844
    self addInterest:(InterestConverterWithParameters
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3845
                            destination:anObject 
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3846
                            selector:selector 
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3847
                            aspect:eventSymbol).
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3848
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3849
    "
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3850
     |p b|
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3851
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3852
     b := [Transcript showCR:'the point changed'].
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3853
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3854
     p := Point new.
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3855
     p whem:#foo:bar: send:#value:value: to:[:a :b | Transcript show:'foo: '; show:a; show:' bar: '; showCR:b].
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3856
     Transcript showCR:'now changing'.
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3857
     p triggerEvent:#foo:bar: withArguments:#('fooArg' 'barArg').
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3858
     p retracrtInterests.
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3859
    "
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3860
! !
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3861
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3862
!Object methodsFor:'displaying'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3863
7081
4e1ae4a0b3c1 added ascentOn: (display-ascent);
Claus Gittinger <cg@exept.de>
parents: 7048
diff changeset
  3864
ascentOn:aGC
4e1ae4a0b3c1 added ascentOn: (display-ascent);
Claus Gittinger <cg@exept.de>
parents: 7048
diff changeset
  3865
    "when displayed via displayOn:, some objects assume that the given y coordinate
4e1ae4a0b3c1 added ascentOn: (display-ascent);
Claus Gittinger <cg@exept.de>
parents: 7048
diff changeset
  3866
     is the baseline (strings, text etc. do), while others assume that the topY
4e1ae4a0b3c1 added ascentOn: (display-ascent);
Claus Gittinger <cg@exept.de>
parents: 7048
diff changeset
  3867
     coordinate is given by y.
4e1ae4a0b3c1 added ascentOn: (display-ascent);
Claus Gittinger <cg@exept.de>
parents: 7048
diff changeset
  3868
     In other words: some draw above the given y coordinate.
4e1ae4a0b3c1 added ascentOn: (display-ascent);
Claus Gittinger <cg@exept.de>
parents: 7048
diff changeset
  3869
     This method returns the number of pixels by which the receiver will draw above
4e1ae4a0b3c1 added ascentOn: (display-ascent);
Claus Gittinger <cg@exept.de>
parents: 7048
diff changeset
  3870
     the given y coordinate."
4e1ae4a0b3c1 added ascentOn: (display-ascent);
Claus Gittinger <cg@exept.de>
parents: 7048
diff changeset
  3871
4e1ae4a0b3c1 added ascentOn: (display-ascent);
Claus Gittinger <cg@exept.de>
parents: 7048
diff changeset
  3872
    ^ (aGC font onDevice:aGC device) ascent
4e1ae4a0b3c1 added ascentOn: (display-ascent);
Claus Gittinger <cg@exept.de>
parents: 7048
diff changeset
  3873
!
4e1ae4a0b3c1 added ascentOn: (display-ascent);
Claus Gittinger <cg@exept.de>
parents: 7048
diff changeset
  3874
6900
3b1eafe032b2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6884
diff changeset
  3875
displayOn:aGCOrStream
7081
4e1ae4a0b3c1 added ascentOn: (display-ascent);
Claus Gittinger <cg@exept.de>
parents: 7048
diff changeset
  3876
    "Compatibility
4e1ae4a0b3c1 added ascentOn: (display-ascent);
Claus Gittinger <cg@exept.de>
parents: 7048
diff changeset
  3877
     append a printed desription on some stream (Dolphin,  Squeak)
4e1ae4a0b3c1 added ascentOn: (display-ascent);
Claus Gittinger <cg@exept.de>
parents: 7048
diff changeset
  3878
     OR:
4e1ae4a0b3c1 added ascentOn: (display-ascent);
Claus Gittinger <cg@exept.de>
parents: 7048
diff changeset
  3879
     display the receiver in a graphicsContext at 0@0 (ST80).
4e1ae4a0b3c1 added ascentOn: (display-ascent);
Claus Gittinger <cg@exept.de>
parents: 7048
diff changeset
  3880
     This method allows for any object to be displayed in some view
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3881
     (although the fallBack is to display its printString ...)"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3882
7081
4e1ae4a0b3c1 added ascentOn: (display-ascent);
Claus Gittinger <cg@exept.de>
parents: 7048
diff changeset
  3883
    "/ what a kludge - Dolphin and Squeak mean: printOn: a stream;
4e1ae4a0b3c1 added ascentOn: (display-ascent);
Claus Gittinger <cg@exept.de>
parents: 7048
diff changeset
  3884
    "/ ST/X (and some old ST80's) mean: draw-yourself on a GC.
6900
3b1eafe032b2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6884
diff changeset
  3885
    (aGCOrStream isStream or:[aGCOrStream == Transcript]) ifTrue:[
3b1eafe032b2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6884
diff changeset
  3886
        self printOn:aGCOrStream.
3b1eafe032b2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6884
diff changeset
  3887
        ^ self
3b1eafe032b2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6884
diff changeset
  3888
    ].
3b1eafe032b2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6884
diff changeset
  3889
    ^ self displayOn:aGCOrStream x:0 y:0.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3890
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3891
    "Created: 29.5.1996 / 16:28:58 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3892
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3893
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3894
displayOn:aGC at:aPoint
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3895
    "ST-80 Compatibility
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3896
     display the receiver in a graphicsContext - this method allows
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3897
     for any object to be displayed in a ListView - for example."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3898
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3899
    ^ self displayOn:aGC x:(aPoint x) y:(aPoint y).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3900
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3901
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3902
displayOn:aGC x:x y:y
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3903
    "display the receiver in a graphicsContext - this method allows
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3904
     for any object to be displayed in a ListView - for example."
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
    self displayOn:aGC x:x y:y opaque:false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3907
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3908
    "Modified: 29.5.1996 / 16:29:38 / cg"
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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3911
displayOn:aGc x:x y:y opaque:opaque
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3912
    "display the receiver in a graphicsContext - this method allows
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3913
     for any object to be displayed in a ListView - for example.
7215
733294e1a8cc correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 7211
diff changeset
  3914
     The fallBack here shows the receivers displayString.
733294e1a8cc correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 7211
diff changeset
  3915
     Notice, that the string is displayed on the baseLine;
733294e1a8cc correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 7211
diff changeset
  3916
     ask using #ascentOn: if required"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3917
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3918
    |s yBaseline|
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
    s := self displayString.
7215
733294e1a8cc correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 7211
diff changeset
  3921
    yBaseline := y "+ aGc font ascent".
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3922
    opaque ifTrue:[
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  3923
        aGc displayOpaqueString:s x:x y:yBaseline.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3924
    ] ifFalse:[
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  3925
        aGc displayString:s x:x y:yBaseline.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3926
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3927
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3928
    "Modified: 29.5.1996 / 16:29:38 / cg"
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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3931
displayOpaqueOn:aGC x:x y:y
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3932
    "display the receiver in a graphicsContext - this method allows
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3933
     for any object to be displayed in a ListView - for example."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3934
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3935
    self displayOn:aGC x:x y:y opaque:true
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3936
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3937
    "Modified: / 29.5.1996 / 16:29:38 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3938
    "Created: / 26.10.1997 / 15:01:36 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3939
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3940
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3941
displayString
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3942
    "return a string used when displaying the receiver in a view;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3943
     for example an Inspector. This is usually the same as printString,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3944
     but sometimes redefined for a better look."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3945
7081
4e1ae4a0b3c1 added ascentOn: (display-ascent);
Claus Gittinger <cg@exept.de>
parents: 7048
diff changeset
  3946
    |s|
4e1ae4a0b3c1 added ascentOn: (display-ascent);
Claus Gittinger <cg@exept.de>
parents: 7048
diff changeset
  3947
8322
95ca965f65ed Handle unicode in #displayString
Stefan Vogel <sv@exept.de>
parents: 8300
diff changeset
  3948
    s := CharacterWriteStream on:(String new:32).
7081
4e1ae4a0b3c1 added ascentOn: (display-ascent);
Claus Gittinger <cg@exept.de>
parents: 7048
diff changeset
  3949
    self displayOn:s.
4e1ae4a0b3c1 added ascentOn: (display-ascent);
Claus Gittinger <cg@exept.de>
parents: 7048
diff changeset
  3950
    ^ s contents
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3951
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3952
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3953
     #(1 2 3) printString    
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3954
     #(1 2 3) displayString  
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3955
     #(1 2 3) storeString
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3956
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3957
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3958
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3959
heightOn:aGC
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3960
    "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
  3961
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3962
    ^ (aGC font onDevice:aGC device) heightOf:(self displayString)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3963
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3964
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  3965
widthFrom:startIndex to:endIndex on:aGC
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  3966
    "return the width of the receiver, if it is to be displayed on aGC"
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  3967
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  3968
    ^ (aGC font onDevice:aGC device) widthOf:(self displayString) from:startIndex to:endIndex
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  3969
!
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  3970
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3971
widthOn:aGC
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3972
    "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
  3973
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3974
    ^ (aGC font onDevice:aGC device) widthOf:(self displayString)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3975
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3976
7359
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3977
!Object methodsFor:'double dispatching'!
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3978
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3979
equalFromComplex:aComplex
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3980
    "adding this method here allows for any non-number to be compared to a complex
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3981
     and return false from this comparison.
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3982
     Reason: we want to be able to put both numbers and non-numbers into a collection
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3983
     which uses #= (i.e. a Set or Dictionary)."
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3984
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3985
    ^ false
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3986
!
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3987
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3988
equalFromFixedPoint:aFixedPoint
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3989
    "adding this method here allows for any non-number to be compared to a fixedPoint
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3990
     and return false from this comparison.
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3991
     Reason: we want to be able to put both numbers and non-numbers into a collection
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3992
     which uses #= (i.e. a Set or Dictionary)."
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3993
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3994
    ^ false
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3995
!
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3996
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3997
equalFromFloat:aFloat
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3998
    "adding this method here allows for any non-number to be compared to a float
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3999
     and return false from this comparison.
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  4000
     Reason: we want to be able to put both numbers and non-numbers into a collection
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  4001
     which uses #= (i.e. a Set or Dictionary)."
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  4002
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  4003
    ^ false
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  4004
!
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  4005
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  4006
equalFromFraction:aFraction
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  4007
    "adding this method here allows for any non-number to be compared to a fraction
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  4008
     and return false from this comparison.
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  4009
     Reason: we want to be able to put both numbers and non-numbers into a collection
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  4010
     which uses #= (i.e. a Set or Dictionary)."
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  4011
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  4012
    ^ false
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  4013
!
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  4014
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  4015
equalFromInteger:anInteger
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  4016
    "adding this method here allows for any non-number to be compared to an integer
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  4017
     and return false from this comparison.
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  4018
     Reason: we want to be able to put both numbers and non-numbers into a collection
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  4019
     which uses #= (i.e. a Set or Dictionary)."
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  4020
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  4021
    ^ false
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  4022
!
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  4023
7455
6abc135763f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7402
diff changeset
  4024
equalFromLargeFloat:aLargeFloat
6abc135763f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7402
diff changeset
  4025
    "adding this method here allows for any non-number to be compared to a largeFloat
6abc135763f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7402
diff changeset
  4026
     and return false from this comparison.
6abc135763f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7402
diff changeset
  4027
     Reason: we want to be able to put both numbers and non-numbers into a collection
6abc135763f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7402
diff changeset
  4028
     which uses #= (i.e. a Set or Dictionary)."
6abc135763f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7402
diff changeset
  4029
6abc135763f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7402
diff changeset
  4030
    ^ false
6abc135763f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7402
diff changeset
  4031
!
6abc135763f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7402
diff changeset
  4032
7359
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  4033
equalFromLongFloat:aLongFloat
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  4034
    "adding this method here allows for any non-number to be compared to a longFloat
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  4035
     and return false from this comparison.
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  4036
     Reason: we want to be able to put both numbers and non-numbers into a collection
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  4037
     which uses #= (i.e. a Set or Dictionary)."
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  4038
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  4039
    ^ false
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  4040
!
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  4041
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  4042
equalFromShortFloat:aShortFloat
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  4043
    "adding this method here allows for any non-number to be compared to a shortFloat
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  4044
     and return false from this comparison.
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  4045
     Reason: we want to be able to put both numbers and non-numbers into a collection
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  4046
     which uses #= (i.e. a Set or Dictionary)."
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  4047
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  4048
    ^ false
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  4049
! !
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  4050
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4051
!Object methodsFor:'encoding & decoding'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4052
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4053
decodeAsLiteralArray
8832
8210e23f6c32 Speed up #literalArrayEncoding
Stefan Vogel <sv@exept.de>
parents: 8829
diff changeset
  4054
    "given a literalEncoding in the receiver,
8210e23f6c32 Speed up #literalArrayEncoding
Stefan Vogel <sv@exept.de>
parents: 8829
diff changeset
  4055
     create & return the corresponding object.
8210e23f6c32 Speed up #literalArrayEncoding
Stefan Vogel <sv@exept.de>
parents: 8829
diff changeset
  4056
     The inverse operation to #literalArrayEncoding."
8210e23f6c32 Speed up #literalArrayEncoding
Stefan Vogel <sv@exept.de>
parents: 8829
diff changeset
  4057
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4058
    ^ self
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4059
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4060
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4061
encodeOn:anEncoder with:aParameter
8397
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  4062
    "not used any longer. Kept for backward comaptibility"
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  4063
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  4064
    <resource: #obsolete>
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  4065
8404
c0bd2a56dc3b *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 8397
diff changeset
  4066
    self acceptVisitor:anEncoder with:aParameter
6718
6d91ccd79d53 Encoding stuff
Stefan Vogel <sv@exept.de>
parents: 6716
diff changeset
  4067
!
6d91ccd79d53 Encoding stuff
Stefan Vogel <sv@exept.de>
parents: 6716
diff changeset
  4068
6d91ccd79d53 Encoding stuff
Stefan Vogel <sv@exept.de>
parents: 6716
diff changeset
  4069
encodingVectorForInstanceVariables
8397
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  4070
    "OBSOLETE, use elementDescriptorForInstanceVariables"
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  4071
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  4072
    <resource: #obsolete>
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  4073
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  4074
    ^ self elementDescriptorForInstanceVariablesMatching:[:val | true].
6718
6d91ccd79d53 Encoding stuff
Stefan Vogel <sv@exept.de>
parents: 6716
diff changeset
  4075
6d91ccd79d53 Encoding stuff
Stefan Vogel <sv@exept.de>
parents: 6716
diff changeset
  4076
    "
6d91ccd79d53 Encoding stuff
Stefan Vogel <sv@exept.de>
parents: 6716
diff changeset
  4077
      #(1 2 3 nil true symbol) encodingVectorForInstanceVariables
6d91ccd79d53 Encoding stuff
Stefan Vogel <sv@exept.de>
parents: 6716
diff changeset
  4078
      Dictionary new encodingVectorForInstanceVariables
6d91ccd79d53 Encoding stuff
Stefan Vogel <sv@exept.de>
parents: 6716
diff changeset
  4079
      (5 @ nil) encodingVectorForInstanceVariables
6d91ccd79d53 Encoding stuff
Stefan Vogel <sv@exept.de>
parents: 6716
diff changeset
  4080
    "
6d91ccd79d53 Encoding stuff
Stefan Vogel <sv@exept.de>
parents: 6716
diff changeset
  4081
!
6d91ccd79d53 Encoding stuff
Stefan Vogel <sv@exept.de>
parents: 6716
diff changeset
  4082
6d91ccd79d53 Encoding stuff
Stefan Vogel <sv@exept.de>
parents: 6716
diff changeset
  4083
encodingVectorForNonNilInstanceVariables
8397
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  4084
    "OBSOLETE, use elementDescriptorForNonNilInstanceVariables"
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  4085
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  4086
    <resource: #obsolete>
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  4087
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  4088
    ^ self elementDescriptorForInstanceVariablesMatching:[:varVal | varVal notNil].
6718
6d91ccd79d53 Encoding stuff
Stefan Vogel <sv@exept.de>
parents: 6716
diff changeset
  4089
6d91ccd79d53 Encoding stuff
Stefan Vogel <sv@exept.de>
parents: 6716
diff changeset
  4090
    "
6d91ccd79d53 Encoding stuff
Stefan Vogel <sv@exept.de>
parents: 6716
diff changeset
  4091
      #(1 2 3 nil true symbol) encodingVectorForNonNilInstanceVariables
6d91ccd79d53 Encoding stuff
Stefan Vogel <sv@exept.de>
parents: 6716
diff changeset
  4092
      (5 @ nil) encodingVectorForNonNilInstanceVariables
6d91ccd79d53 Encoding stuff
Stefan Vogel <sv@exept.de>
parents: 6716
diff changeset
  4093
    "
6d91ccd79d53 Encoding stuff
Stefan Vogel <sv@exept.de>
parents: 6716
diff changeset
  4094
!
6d91ccd79d53 Encoding stuff
Stefan Vogel <sv@exept.de>
parents: 6716
diff changeset
  4095
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4096
fromLiteralArrayEncoding:aSpecArray
8798
73676c762813 comment
Claus Gittinger <cg@exept.de>
parents: 8789
diff changeset
  4097
    "read my attributes from aSpecArray.
73676c762813 comment
Claus Gittinger <cg@exept.de>
parents: 8789
diff changeset
  4098
     Recursively decodes arguments."
73676c762813 comment
Claus Gittinger <cg@exept.de>
parents: 8789
diff changeset
  4099
73676c762813 comment
Claus Gittinger <cg@exept.de>
parents: 8789
diff changeset
  4100
    |sel litVal val
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4101
     stop   "{ Class:SmallInteger }" |
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
    stop := aSpecArray size.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4104
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4105
    2 to:stop by:2 do:[:i|
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  4106
        sel := aSpecArray at:i.
8798
73676c762813 comment
Claus Gittinger <cg@exept.de>
parents: 8789
diff changeset
  4107
        litVal := aSpecArray at:i + 1.
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  4108
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  4109
        (self respondsTo:sel) ifTrue:[
8798
73676c762813 comment
Claus Gittinger <cg@exept.de>
parents: 8789
diff changeset
  4110
            val := litVal decodeAsLiteralArray.
73676c762813 comment
Claus Gittinger <cg@exept.de>
parents: 8789
diff changeset
  4111
            self perform:sel with:val
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  4112
        ] ifFalse:[
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  4113
            Transcript show:self class name; show:': unhandled literalArrayEncoding attribute: '.
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  4114
            Transcript showCR:sel.
8798
73676c762813 comment
Claus Gittinger <cg@exept.de>
parents: 8789
diff changeset
  4115
73676c762813 comment
Claus Gittinger <cg@exept.de>
parents: 8789
diff changeset
  4116
            "/ thats a debug halt,
73676c762813 comment
Claus Gittinger <cg@exept.de>
parents: 8789
diff changeset
  4117
            "/ it should probably be removed (to simply ignore unhandled attributes)...
73676c762813 comment
Claus Gittinger <cg@exept.de>
parents: 8789
diff changeset
  4118
            "/ for now, it is left in, in order to easily find incompatibilities between
73676c762813 comment
Claus Gittinger <cg@exept.de>
parents: 8789
diff changeset
  4119
            "/ VW and ST/X.
73676c762813 comment
Claus Gittinger <cg@exept.de>
parents: 8789
diff changeset
  4120
            self halt:('Unrecognized attribute in spec: #', sel).  "/ value is:   val  / litVal.
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  4121
        ]
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4122
    ]
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4123
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4124
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4125
literalArrayEncoding
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4126
    "generate a literalArrayEncoding array for myself.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4127
     This uses #literalArrayEncodingSlotOrder which defines the slots and
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4128
     order and #skippedInLiteralEncoding which defines slots to skip.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4129
     For most subclasses, there is no need to redefine those."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4130
8832
8210e23f6c32 Speed up #literalArrayEncoding
Stefan Vogel <sv@exept.de>
parents: 8829
diff changeset
  4131
    |names encoding cls skipped slots|
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4132
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4133
    self isLiteral ifTrue:[
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  4134
        ^ self
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4135
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4136
8832
8210e23f6c32 Speed up #literalArrayEncoding
Stefan Vogel <sv@exept.de>
parents: 8829
diff changeset
  4137
    slots    := self literalArrayEncodingSlotOrder.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4138
    skipped  := self skippedInLiteralEncoding.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4139
    cls      := self class.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4140
    names    := cls allInstVarNames.
8832
8210e23f6c32 Speed up #literalArrayEncoding
Stefan Vogel <sv@exept.de>
parents: 8829
diff changeset
  4141
    encoding := OrderedCollection new:(1 + (2 * (slots size - skipped size))).
8839
c4471cb2799f stefan: bitte vor Einchecken Testen !
Claus Gittinger <cg@exept.de>
parents: 8833
diff changeset
  4142
    encoding add:cls name.
8832
8210e23f6c32 Speed up #literalArrayEncoding
Stefan Vogel <sv@exept.de>
parents: 8829
diff changeset
  4143
8210e23f6c32 Speed up #literalArrayEncoding
Stefan Vogel <sv@exept.de>
parents: 8829
diff changeset
  4144
    slots do:[:instSlot |
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  4145
        |value nm|
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  4146
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  4147
        nm := names at:instSlot.
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  4148
        (skipped includes:nm) ifFalse:[
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  4149
            (value := self instVarAt:instSlot) notNil ifTrue:[
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  4150
                encoding add:(nm , ':') asSymbol.
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  4151
                encoding add:value literalArrayEncoding
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  4152
            ]
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  4153
        ]
5755
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
    ^ encoding asArray
8841
d5acf50ec5a6 Comment
Stefan Vogel <sv@exept.de>
parents: 8839
diff changeset
  4156
d5acf50ec5a6 Comment
Stefan Vogel <sv@exept.de>
parents: 8839
diff changeset
  4157
    "
d5acf50ec5a6 Comment
Stefan Vogel <sv@exept.de>
parents: 8839
diff changeset
  4158
        (1 -> 2) literalArrayEncoding
d5acf50ec5a6 Comment
Stefan Vogel <sv@exept.de>
parents: 8839
diff changeset
  4159
        DebugView menuSpec decodeAsLiteralArray literalArrayEncoding  =
d5acf50ec5a6 Comment
Stefan Vogel <sv@exept.de>
parents: 8839
diff changeset
  4160
           DebugView menuSpec
d5acf50ec5a6 Comment
Stefan Vogel <sv@exept.de>
parents: 8839
diff changeset
  4161
    "
5755
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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4164
literalArrayEncodingSlotOrder
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4165
    "define the order in which inst-slots are saved when generating
8397
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  4166
     a literalArrayEncoding"
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  4167
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4168
    ^ 1 to:self class instSize
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4169
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4170
7112
6299f5d9129c added postDecodeFrom - to allow for an object to
martin
parents: 7094
diff changeset
  4171
postDecodeFrom:aDecoder aspect:aspectSymbol
6299f5d9129c added postDecodeFrom - to allow for an object to
martin
parents: 7094
diff changeset
  4172
    "invoked by xmlDecoder (and others in the future), after an
6299f5d9129c added postDecodeFrom - to allow for an object to
martin
parents: 7094
diff changeset
  4173
     object has been decoded (i.e. its instance variables have been restored)"
6299f5d9129c added postDecodeFrom - to allow for an object to
martin
parents: 7094
diff changeset
  4174
8397
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  4175
    ^ self
7112
6299f5d9129c added postDecodeFrom - to allow for an object to
martin
parents: 7094
diff changeset
  4176
!
6299f5d9129c added postDecodeFrom - to allow for an object to
martin
parents: 7094
diff changeset
  4177
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4178
skippedInLiteralEncoding
8397
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  4179
    "return a Collection with it's elements are slots for skipping"
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  4180
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4181
    ^ #()
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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4184
!Object methodsFor:'error handling'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4185
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4186
appropriateDebugger:aSelector
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4187
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4188
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4189
    "return an appropriate debugger to use.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4190
     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
  4191
     the DebugView, return MiniDebugger (as a last chance) otherwise abort."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4192
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4193
    |context|
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
    "DebugView cannot run without system processes"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4196
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4197
    (Processor isNil 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4198
    or:[Processor activeProcessIsSystemProcess
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4199
    or:[Smalltalk isInitialized not]]) ifTrue:[
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  4200
        ^ MiniDebugger
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4201
    ].
6778
87e2d95ce8a4 Raise #drawingOnClosedDeviceSignal instead of #error
Stefan Vogel <sv@exept.de>
parents: 6764
diff changeset
  4202
    (Screen isNil or:[Screen default isNil or:[Screen default isOpen not]]) ifTrue:[
87e2d95ce8a4 Raise #drawingOnClosedDeviceSignal instead of #error
Stefan Vogel <sv@exept.de>
parents: 6764
diff changeset
  4203
        Debugger isNil ifTrue:[^ nil].
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  4204
        ^ MiniDebugger
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4205
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4206
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4207
    context := thisContext.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4208
    context := context findNextContextWithSelector:aSelector or:nil or:nil.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4209
    [context notNil] whileTrue:[
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  4210
        ((context receiver class == Debugger) 
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  4211
         and:[context selector == aSelector]) ifTrue:[
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  4212
            "we are already in some Debugger"
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  4213
            (Debugger == MiniDebugger) ifTrue:[
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  4214
                "we are already in the MiniDebugger"
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  4215
                ErrorRecursion ifFalse:[
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  4216
                    Smalltalk fatalAbort:'recursive error ...'
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  4217
                ]
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  4218
            ].
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  4219
            MiniDebugger isNil ifTrue:[
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  4220
                Smalltalk fatalAbort:'no debugger'
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  4221
            ].
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  4222
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  4223
            "ok, an error occured while in the graphical debugger;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  4224
             lets try MiniDebugger"
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  4225
            ^ MiniDebugger
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  4226
        ].
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  4227
        context := context findNextContextWithSelector:aSelector or:nil or:nil.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4228
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4229
    "not within Debugger - no problem"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4230
    ^ Debugger
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
    "Modified: / 23.9.1996 / 12:14:52 / stefan"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4233
    "Modified: / 19.5.1999 / 18:05:00 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4234
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4235
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4236
cannotSendMessage:aMessage to:someReceiver
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4237
    "this message is sent by the runtime system (VM),
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4238
     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
  4239
     a valid behavior (see documentation in Behavior)."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4240
8330
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
  4241
    ^ VMInternalError
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  4242
          raiseWith:someReceiver
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  4243
          errorString:('bad class in send of #' , aMessage selector)
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4244
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4245
    "Modified: 23.1.1997 / 00:05:39 / cg"
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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4248
doesNotUnderstand:aMessage
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4249
    "this message is sent by the runtime system (VM) when
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4250
     a message is not understood by some object (i.e. there
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4251
     is no method for that selector). The original message has
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4252
     been packed into aMessage (i.e. the receiver, selector and
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4253
     any arguments) and the original receiver is then sent the
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4254
     #doesNotUnderstand: message.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4255
     Here, we raise another signal which usually enters the debugger.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4256
     You can of course redefine #doesNotUnderstand: in your classes
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4257
     to implement message delegation, 
8500
10d47cede03c Speed up MessageNotUnderstood exception sending by layz computation
Stefan Vogel <sv@exept.de>
parents: 8481
diff changeset
  4258
     or handle the MessageNotUnderstood exception gracefully."
5755
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
    <context: #return>
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4261
8500
10d47cede03c Speed up MessageNotUnderstood exception sending by layz computation
Stefan Vogel <sv@exept.de>
parents: 8481
diff changeset
  4262
    ^ MessageNotUnderstood raiseRequestWith:aMessage
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4263
!
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
elementBoundsError
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4266
    "{ Pragma: +optSpace }"
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
    "report an error that badElement is out of bounds 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4269
     (i.e. cannot be put into that collection).
8330
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
  4270
     The error is reported by raising the ElementBoundsError exception."
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
  4271
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
  4272
    ^ ElementBoundsError raise
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4273
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4274
    "Modified: 8.5.1996 / 09:12:45 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4275
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4276
7215
733294e1a8cc correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 7211
diff changeset
  4277
elementBoundsError:aValue
733294e1a8cc correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 7211
diff changeset
  4278
    "{ Pragma: +optSpace }"
733294e1a8cc correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 7211
diff changeset
  4279
733294e1a8cc correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 7211
diff changeset
  4280
    "report an error that aValue is not valid as element  
733294e1a8cc correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 7211
diff changeset
  4281
     (i.e. cannot be put into that collection).
8330
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
  4282
     The error is reported by raising the ElementBoundsError exception."
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
  4283
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
  4284
    ^ ElementBoundsError raiseWith:aValue
7215
733294e1a8cc correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 7211
diff changeset
  4285
733294e1a8cc correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 7211
diff changeset
  4286
    "Modified: 8.5.1996 / 09:12:45 / cg"
733294e1a8cc correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 7211
diff changeset
  4287
!
733294e1a8cc correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 7211
diff changeset
  4288
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4289
elementNotCharacter
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4290
    "{ Pragma: +optSpace }"
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
    "report an error that object to be stored is no Character.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4293
     (usually when storing into Strings).
8330
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
  4294
     The error is reported by raising the ElementBoundsError exception."
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
  4295
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
  4296
    ^ ElementBoundsError raise
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4297
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4298
    "Modified: 8.5.1996 / 09:12:49 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4299
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4300
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4301
elementNotInteger
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4302
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4303
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4304
    "report an error that object to be stored is not Integer.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4305
     (in collections that store integers only).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4306
     The error is reported by raising the ElementOutOfBoundsSignal exception."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4307
8330
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
  4308
    ^ ElementBoundsError raise
5755
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
    "Modified: 8.5.1996 / 09:12:51 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4311
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4312
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4313
error
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4314
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4315
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4316
    <context: #return>
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4317
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4318
    "report error that an error occured.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4319
     The error is reported by raising the Error exception,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4320
     which is non-proceedable.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4321
     If no handler has been setup, a debugger is entered."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4322
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4323
    Error raiseWith:#error:
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4324
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
     nil error
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4327
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4328
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4329
    "Modified: / 8.5.1996 / 09:13:01 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4330
    "Modified: / 2.8.1999 / 17:00:19 / stefan"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4331
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4332
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4333
error:aString
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4334
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4335
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4336
    <context: #return>
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4337
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4338
    "Raise an error with error message aString.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4339
     The error is reported by raising the Error exception,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4340
     which is non-proceedable.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4341
     If no handler has been setup, a debugger is entered."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4342
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4343
    Error raiseWith:#error: errorString:aString 
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
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4346
      nil error:' bad bad bad'
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4347
    "
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
    "Modified: 8.5.1996 / 09:13:04 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4350
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4351
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4352
error:aString mayProceed:mayProceed
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4353
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4354
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4355
    "enter debugger with error-message aString.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4356
     The error is reported by raising either the 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4357
     non-proceedable Error exception,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4358
     or the ProceedableError exception."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4359
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4360
    mayProceed ifTrue:[
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  4361
        ^ ProceedableError raiseRequestWith:#error: errorString:aString 
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4362
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4363
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4364
    Error raiseWith:#error: errorString:aString 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4365
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4366
    "Modified: 8.5.1996 / 09:13:04 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4367
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4368
6900
3b1eafe032b2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6884
diff changeset
  4369
errorInvalidFormat
3b1eafe032b2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6884
diff changeset
  4370
    "{ Pragma: +optSpace }"
3b1eafe032b2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6884
diff changeset
  4371
3b1eafe032b2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6884
diff changeset
  4372
    <context: #return>
3b1eafe032b2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6884
diff changeset
  4373
3b1eafe032b2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6884
diff changeset
  4374
    "report an error that some conversion to/from string representation failed
3b1eafe032b2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6884
diff changeset
  4375
     typically when converting numbers, date, time etc."
3b1eafe032b2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6884
diff changeset
  4376
3b1eafe032b2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6884
diff changeset
  4377
    ^ ConversionError raiseErrorString:'invalid format'
3b1eafe032b2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6884
diff changeset
  4378
!
3b1eafe032b2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6884
diff changeset
  4379
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4380
errorKeyNotFound:aKey
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4381
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4382
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4383
    "report an error that a key was not found in a collection.
8330
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
  4384
     The error is reported by raising the KeyNotFoundError exception."
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
  4385
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
  4386
    ^ KeyNotFoundError raiseRequestWith:aKey
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
  4387
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
  4388
    "
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
  4389
     Dictionary new at:#nonExistantElement
5755
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
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4392
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4393
errorNotFound
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4394
    "{ Pragma: +optSpace }"
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
    "report an error that no element was found in a collection.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4397
     The error is reported by raising the NotFoundSignal exception."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4398
6946
905fcfc8699b signal-classVars replaced by error-class access
Claus Gittinger <cg@exept.de>
parents: 6932
diff changeset
  4399
    ^ NotFoundError raiseRequestWith:nil
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4400
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4401
    "Modified: / 8.5.1996 / 09:13:11 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4402
    "Modified: / 26.7.1999 / 10:51:50 / stefan"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4403
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4404
6874
c539a4c44df1 +errorNotFound:
Claus Gittinger <cg@exept.de>
parents: 6845
diff changeset
  4405
errorNotFound:errorString
c539a4c44df1 +errorNotFound:
Claus Gittinger <cg@exept.de>
parents: 6845
diff changeset
  4406
    "{ Pragma: +optSpace }"
c539a4c44df1 +errorNotFound:
Claus Gittinger <cg@exept.de>
parents: 6845
diff changeset
  4407
c539a4c44df1 +errorNotFound:
Claus Gittinger <cg@exept.de>
parents: 6845
diff changeset
  4408
    "report an error that no element was found in a collection.
c539a4c44df1 +errorNotFound:
Claus Gittinger <cg@exept.de>
parents: 6845
diff changeset
  4409
     The error is reported by raising the NotFoundSignal exception."
c539a4c44df1 +errorNotFound:
Claus Gittinger <cg@exept.de>
parents: 6845
diff changeset
  4410
c539a4c44df1 +errorNotFound:
Claus Gittinger <cg@exept.de>
parents: 6845
diff changeset
  4411
    ^ NotFoundError raiseErrorString:errorString
c539a4c44df1 +errorNotFound:
Claus Gittinger <cg@exept.de>
parents: 6845
diff changeset
  4412
!
c539a4c44df1 +errorNotFound:
Claus Gittinger <cg@exept.de>
parents: 6845
diff changeset
  4413
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4414
errorSignal
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4415
    ^ self class errorSignal
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4416
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4417
    "Created: / 19.6.1998 / 02:32:32 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4418
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4419
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4420
halt
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4421
    "{ Pragma: +optSpace }"
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
    "enter debugger with halt-message.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4424
     The error is reported by raising the HaltSignal exception."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4425
6716
7e2bac4221d1 allow for halts to be ignored
Claus Gittinger <cg@exept.de>
parents: 6708
diff changeset
  4426
    (Smalltalk at:#IgnoreHalt ifAbsent:false) == true ifTrue:[^ self].
6221
404495587300 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6203
diff changeset
  4427
    ^ HaltInterrupt raiseRequestWith:#halt
404495587300 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6203
diff changeset
  4428
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4429
    "Modified: / 2.8.1999 / 17:00:29 / stefan"
6221
404495587300 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6203
diff changeset
  4430
    "Modified: / 17.11.2001 / 22:47:44 / cg"
5755
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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4433
halt:aString
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4434
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4435
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4436
    "enter debugger with halt-message.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4437
     The error is reported by raising the HaltSignal exception."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4438
6716
7e2bac4221d1 allow for halts to be ignored
Claus Gittinger <cg@exept.de>
parents: 6708
diff changeset
  4439
    (Smalltalk at:#IgnoreHalt ifAbsent:false) == true ifTrue:[^ self].
6946
905fcfc8699b signal-classVars replaced by error-class access
Claus Gittinger <cg@exept.de>
parents: 6932
diff changeset
  4440
    ^ HaltInterrupt raiseRequestWith:#halt: errorString:aString
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4441
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4442
    "Modified: 8.5.1996 / 09:13:23 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4443
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4444
7322
178e33c2a376 catch non-block/non-signal/non-exception being
Claus Gittinger <cg@exept.de>
parents: 7320
diff changeset
  4445
handlerForSignal:exceptionHandler context:theContext originator:originator
178e33c2a376 catch non-block/non-signal/non-exception being
Claus Gittinger <cg@exept.de>
parents: 7320
diff changeset
  4446
    " should never be invoked for non-blocks/non-exceptions/non-signals"
178e33c2a376 catch non-block/non-signal/non-exception being
Claus Gittinger <cg@exept.de>
parents: 7320
diff changeset
  4447
7566
f691eac0f114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7562
diff changeset
  4448
    thisContext isRecursive ifTrue:[^ nil].
f691eac0f114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7562
diff changeset
  4449
7322
178e33c2a376 catch non-block/non-signal/non-exception being
Claus Gittinger <cg@exept.de>
parents: 7320
diff changeset
  4450
    'Warning: handlerForSignal invoked for: ' print. self printCR.
178e33c2a376 catch non-block/non-signal/non-exception being
Claus Gittinger <cg@exept.de>
parents: 7320
diff changeset
  4451
    '         context: ' print. theContext printCR.
178e33c2a376 catch non-block/non-signal/non-exception being
Claus Gittinger <cg@exept.de>
parents: 7320
diff changeset
  4452
    '         originator: ' print. originator printCR.
178e33c2a376 catch non-block/non-signal/non-exception being
Claus Gittinger <cg@exept.de>
parents: 7320
diff changeset
  4453
    '         sender: ' print. thisContext sender printCR.
178e33c2a376 catch non-block/non-signal/non-exception being
Claus Gittinger <cg@exept.de>
parents: 7320
diff changeset
  4454
7566
f691eac0f114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7562
diff changeset
  4455
    "/ MiniDebugger enter:thisContext withMessage:'oops' mayProceed:true.
f691eac0f114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7562
diff changeset
  4456
    self error:'this method should only be invoked for blocks, exceptions and signals'.
7322
178e33c2a376 catch non-block/non-signal/non-exception being
Claus Gittinger <cg@exept.de>
parents: 7320
diff changeset
  4457
!
178e33c2a376 catch non-block/non-signal/non-exception being
Claus Gittinger <cg@exept.de>
parents: 7320
diff changeset
  4458
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4459
implementedBySubclass
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4460
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4461
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4462
    "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
  4463
6721
e5f47c6e2f40 #subclassResponsibility & #subclassResponsibility:
Claus Gittinger <cg@exept.de>
parents: 6718
diff changeset
  4464
    ^ self subclassResponsibility:'method must be reimplemented in ST/V subclass'
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4465
!
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
indexNotInteger
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4468
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4469
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4470
    "report an error that index is not an Integer.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4471
     (when accessing collections indexed by an integer key).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4472
     The error is reported by raising the NonIntegerIndexSignal exception."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4473
6946
905fcfc8699b signal-classVars replaced by error-class access
Claus Gittinger <cg@exept.de>
parents: 6932
diff changeset
  4474
    ^ NonIntegerIndexError raiseRequestWith:nil
5755
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
    "Modified: / 8.5.1996 / 09:13:37 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4477
    "Modified: / 26.7.1999 / 10:57:43 / stefan"
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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4480
indexNotInteger:anIndex
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4481
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4482
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4483
    "report an error that index is not an Integer.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4484
     (when accessing collections indexed by an integer key).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4485
     The error is reported by raising the NonIntegerIndexSignal exception."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4486
6946
905fcfc8699b signal-classVars replaced by error-class access
Claus Gittinger <cg@exept.de>
parents: 6932
diff changeset
  4487
    ^ NonIntegerIndexError raiseRequestWith:anIndex 
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4488
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4489
    "Created: / 16.5.1998 / 19:39:41 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4490
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4491
7216
59bfa2ffdcf7 utility
Claus Gittinger <cg@exept.de>
parents: 7215
diff changeset
  4492
indexNotIntegerOrOutOfBounds:index
59bfa2ffdcf7 utility
Claus Gittinger <cg@exept.de>
parents: 7215
diff changeset
  4493
    "{ Pragma: +optSpace }"
59bfa2ffdcf7 utility
Claus Gittinger <cg@exept.de>
parents: 7215
diff changeset
  4494
59bfa2ffdcf7 utility
Claus Gittinger <cg@exept.de>
parents: 7215
diff changeset
  4495
    "report an error that index is either non-integral or out of bounds"
59bfa2ffdcf7 utility
Claus Gittinger <cg@exept.de>
parents: 7215
diff changeset
  4496
59bfa2ffdcf7 utility
Claus Gittinger <cg@exept.de>
parents: 7215
diff changeset
  4497
    index isInteger ifFalse:[
59bfa2ffdcf7 utility
Claus Gittinger <cg@exept.de>
parents: 7215
diff changeset
  4498
        ^ self indexNotInteger:index
59bfa2ffdcf7 utility
Claus Gittinger <cg@exept.de>
parents: 7215
diff changeset
  4499
    ].
59bfa2ffdcf7 utility
Claus Gittinger <cg@exept.de>
parents: 7215
diff changeset
  4500
    ^ self subscriptBoundsError:index
59bfa2ffdcf7 utility
Claus Gittinger <cg@exept.de>
parents: 7215
diff changeset
  4501
!
59bfa2ffdcf7 utility
Claus Gittinger <cg@exept.de>
parents: 7215
diff changeset
  4502
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4503
integerCheckError
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
    "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
  4507
     value assigned"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4508
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4509
    ^ self error:'bad assign of ' , self printString , 
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  4510
                  ' (' , self class name , ') to integer-typed variable'
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4511
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4512
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4513
invalidCodeObject
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4514
    "{ Pragma: +optSpace }"
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
    self error:'not an executable code object'
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4517
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4518
    "Created: 1.8.1997 / 00:16:44 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4519
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4520
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4521
invalidMessage 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4522
    "{ Pragma: +optSpace }"
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
    "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
  4525
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4526
    ^ self shouldNotImplement
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4527
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4528
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4529
mustBeRectangle
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4530
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4531
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4532
    "report an argument-not-rectangle-error"
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
    ^ self error:'argument must be a Rectangle'
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4535
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4536
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4537
mustBeString
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4538
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4539
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4540
    "report an argument-not-string-error"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4541
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4542
    ^ self error:'argument must be a String'
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4543
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4544
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4545
notIndexed
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4546
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4547
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4548
    <context: #return>
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4549
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4550
    "report an error that receiver has no indexed instance variables.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4551
     The error is reported by raising the SubscriptOutOfBoundsSignal exception."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4552
6946
905fcfc8699b signal-classVars replaced by error-class access
Claus Gittinger <cg@exept.de>
parents: 6932
diff changeset
  4553
    ^ SubscriptOutOfBoundsError 
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  4554
        raiseErrorString:'receiver has no indexed variables'
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4555
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4556
    "Modified: 26.7.1996 / 16:43:13 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4557
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4558
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4559
openDebuggerOnException:ex
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4560
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4561
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4562
    "enter the debugger on some unhandled exception"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4563
6884
de5e191dbfaf more standAlone support
Claus Gittinger <cg@exept.de>
parents: 6877
diff changeset
  4564
    |msgString debugger answer|
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4565
7208
b95620b2c6b6 #errorSignal -> #description
Stefan Vogel <sv@exept.de>
parents: 7204
diff changeset
  4566
    msgString := ex description.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4567
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4568
     if there is no debugger,
8397
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  4569
     ask for ignore or exit. Exit will terminate the application.
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  4570
     ignore will raise an AbortOperationRequest.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4571
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4572
    Debugger isNil ifTrue:[
6840
073cdeca1681 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6829
diff changeset
  4573
        msgString := 'Error: ' , msgString.
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  4574
7562
869c48046a5c oops - standAlone debugging fixed
Claus Gittinger <cg@exept.de>
parents: 7539
diff changeset
  4575
        thisContext isRecursive ifTrue:[
869c48046a5c oops - standAlone debugging fixed
Claus Gittinger <cg@exept.de>
parents: 7539
diff changeset
  4576
            msgString errorPrintCR.
869c48046a5c oops - standAlone debugging fixed
Claus Gittinger <cg@exept.de>
parents: 7539
diff changeset
  4577
            Smalltalk fatalAbort:'recursive unhandled exception'
869c48046a5c oops - standAlone debugging fixed
Claus Gittinger <cg@exept.de>
parents: 7539
diff changeset
  4578
        ].
869c48046a5c oops - standAlone debugging fixed
Claus Gittinger <cg@exept.de>
parents: 7539
diff changeset
  4579
9509
bfb55a08130d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9442
diff changeset
  4580
        Smalltalk isSmalltalkDevelopmentSystem ifFalse:[
9297
de57e4607c5b halt in standAlone app.
Claus Gittinger <cg@exept.de>
parents: 9293
diff changeset
  4581
            ex parameter signal == HaltInterrupt ifTrue:[
de57e4607c5b halt in standAlone app.
Claus Gittinger <cg@exept.de>
parents: 9293
diff changeset
  4582
                "/ 'Halt ignored' infoPrintCR.
de57e4607c5b halt in standAlone app.
Claus Gittinger <cg@exept.de>
parents: 9293
diff changeset
  4583
                ^ self
de57e4607c5b halt in standAlone app.
Claus Gittinger <cg@exept.de>
parents: 9293
diff changeset
  4584
            ].
de57e4607c5b halt in standAlone app.
Claus Gittinger <cg@exept.de>
parents: 9293
diff changeset
  4585
7562
869c48046a5c oops - standAlone debugging fixed
Claus Gittinger <cg@exept.de>
parents: 7539
diff changeset
  4586
            (Dialog notNil and:[Screen default notNil]) ifTrue:[
8397
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  4587
                AbortOperationRequest isHandled ifTrue:[
7208
b95620b2c6b6 #errorSignal -> #description
Stefan Vogel <sv@exept.de>
parents: 7204
diff changeset
  4588
                    answer := OptionBox
b95620b2c6b6 #errorSignal -> #description
Stefan Vogel <sv@exept.de>
parents: 7204
diff changeset
  4589
                            request:msgString
b95620b2c6b6 #errorSignal -> #description
Stefan Vogel <sv@exept.de>
parents: 7204
diff changeset
  4590
                            label:msgString
9299
f5fe49cd9bcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9298
diff changeset
  4591
                            buttonLabels:#('Exit' 'Terminate Thread' 'Ignore' 'Abort' )
f5fe49cd9bcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9298
diff changeset
  4592
                            values:#(exit terminate ignore abort)
9298
2629011bf060 added terminate to unhandled exception dialog
Claus Gittinger <cg@exept.de>
parents: 9297
diff changeset
  4593
                            default:#abort.
7208
b95620b2c6b6 #errorSignal -> #description
Stefan Vogel <sv@exept.de>
parents: 7204
diff changeset
  4594
                ] ifFalse:[
b95620b2c6b6 #errorSignal -> #description
Stefan Vogel <sv@exept.de>
parents: 7204
diff changeset
  4595
                    answer := OptionBox
b95620b2c6b6 #errorSignal -> #description
Stefan Vogel <sv@exept.de>
parents: 7204
diff changeset
  4596
                            request:msgString
b95620b2c6b6 #errorSignal -> #description
Stefan Vogel <sv@exept.de>
parents: 7204
diff changeset
  4597
                            label:msgString
9299
f5fe49cd9bcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9298
diff changeset
  4598
                            buttonLabels:#('Exit' 'Terminate Thread' 'Ignore' )
f5fe49cd9bcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9298
diff changeset
  4599
                            values:#(exit terminate ignore )
9298
2629011bf060 added terminate to unhandled exception dialog
Claus Gittinger <cg@exept.de>
parents: 9297
diff changeset
  4600
                            default:#terminate.
7208
b95620b2c6b6 #errorSignal -> #description
Stefan Vogel <sv@exept.de>
parents: 7204
diff changeset
  4601
                ].
7562
869c48046a5c oops - standAlone debugging fixed
Claus Gittinger <cg@exept.de>
parents: 7539
diff changeset
  4602
6884
de5e191dbfaf more standAlone support
Claus Gittinger <cg@exept.de>
parents: 6877
diff changeset
  4603
                answer == #abort ifTrue:[
8397
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  4604
                    ^ AbortOperationRequest raiseRequest
6884
de5e191dbfaf more standAlone support
Claus Gittinger <cg@exept.de>
parents: 6877
diff changeset
  4605
                ].
7208
b95620b2c6b6 #errorSignal -> #description
Stefan Vogel <sv@exept.de>
parents: 7204
diff changeset
  4606
                answer == #ignore ifTrue:[
6884
de5e191dbfaf more standAlone support
Claus Gittinger <cg@exept.de>
parents: 6877
diff changeset
  4607
                    ^ nil
de5e191dbfaf more standAlone support
Claus Gittinger <cg@exept.de>
parents: 6877
diff changeset
  4608
                ].
9298
2629011bf060 added terminate to unhandled exception dialog
Claus Gittinger <cg@exept.de>
parents: 9297
diff changeset
  4609
                answer == #terminate ifTrue:[
2629011bf060 added terminate to unhandled exception dialog
Claus Gittinger <cg@exept.de>
parents: 9297
diff changeset
  4610
                    ^ Processor activeProcess terminate.
2629011bf060 added terminate to unhandled exception dialog
Claus Gittinger <cg@exept.de>
parents: 9297
diff changeset
  4611
                ].
9314
93bac344273f asking twice to exit applicaion after unhandled exception (only standalone app)
Michael Beyl <mb@exept.de>
parents: 9299
diff changeset
  4612
                "asking second time here to prevent the user from accidently closing his app"
93bac344273f asking twice to exit applicaion after unhandled exception (only standalone app)
Michael Beyl <mb@exept.de>
parents: 9299
diff changeset
  4613
                answer == #exit ifTrue:[
93bac344273f asking twice to exit applicaion after unhandled exception (only standalone app)
Michael Beyl <mb@exept.de>
parents: 9299
diff changeset
  4614
                    answer := OptionBox
93bac344273f asking twice to exit applicaion after unhandled exception (only standalone app)
Michael Beyl <mb@exept.de>
parents: 9299
diff changeset
  4615
                            request:'Do you really wish to exit this application (all changes will be lost)?'
93bac344273f asking twice to exit applicaion after unhandled exception (only standalone app)
Michael Beyl <mb@exept.de>
parents: 9299
diff changeset
  4616
                            label:msgString
93bac344273f asking twice to exit applicaion after unhandled exception (only standalone app)
Michael Beyl <mb@exept.de>
parents: 9299
diff changeset
  4617
                            buttonLabels:#('Yes' 'No' )
93bac344273f asking twice to exit applicaion after unhandled exception (only standalone app)
Michael Beyl <mb@exept.de>
parents: 9299
diff changeset
  4618
                            values:#(exit abort)
93bac344273f asking twice to exit applicaion after unhandled exception (only standalone app)
Michael Beyl <mb@exept.de>
parents: 9299
diff changeset
  4619
                            default:#abort.
93bac344273f asking twice to exit applicaion after unhandled exception (only standalone app)
Michael Beyl <mb@exept.de>
parents: 9299
diff changeset
  4620
                ].
93bac344273f asking twice to exit applicaion after unhandled exception (only standalone app)
Michael Beyl <mb@exept.de>
parents: 9299
diff changeset
  4621
                answer == #abort ifTrue:[
93bac344273f asking twice to exit applicaion after unhandled exception (only standalone app)
Michael Beyl <mb@exept.de>
parents: 9299
diff changeset
  4622
                    ^ AbortOperationRequest raiseRequest
93bac344273f asking twice to exit applicaion after unhandled exception (only standalone app)
Michael Beyl <mb@exept.de>
parents: 9299
diff changeset
  4623
                ].
93bac344273f asking twice to exit applicaion after unhandled exception (only standalone app)
Michael Beyl <mb@exept.de>
parents: 9299
diff changeset
  4624
93bac344273f asking twice to exit applicaion after unhandled exception (only standalone app)
Michael Beyl <mb@exept.de>
parents: 9299
diff changeset
  4625
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  4626
            ].
8397
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  4627
            "don't output the message, if its a CTRL-C (userInterrupt)" 
6845
bc8e45d10f43 dont out the "unhandled exception..." message,
Claus Gittinger <cg@exept.de>
parents: 6840
diff changeset
  4628
            ex signal == NoHandlerError ifTrue:[
bc8e45d10f43 dont out the "unhandled exception..." message,
Claus Gittinger <cg@exept.de>
parents: 6840
diff changeset
  4629
                ex parameter signal == UserInterrupt ifTrue:[
bc8e45d10f43 dont out the "unhandled exception..." message,
Claus Gittinger <cg@exept.de>
parents: 6840
diff changeset
  4630
                    OperatingSystem exit:130
bc8e45d10f43 dont out the "unhandled exception..." message,
Claus Gittinger <cg@exept.de>
parents: 6840
diff changeset
  4631
                ].
bc8e45d10f43 dont out the "unhandled exception..." message,
Claus Gittinger <cg@exept.de>
parents: 6840
diff changeset
  4632
            ].
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  4633
            msgString errorPrintCR.
9203
9bd6647d1c63 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9146
diff changeset
  4634
            thisContext fullPrintAll.    
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  4635
            OperatingSystem exit:1
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  4636
        ].
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  4637
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  4638
        msgString errorPrintCR.
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  4639
        Smalltalk fatalAbort:'no Debugger defined'
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4640
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4641
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4642
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4643
     find an appropriate debugger to use
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4644
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4645
    debugger := self appropriateDebugger:(thisContext selector).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4646
    debugger isNil ifTrue:[
8397
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  4647
        ^ AbortOperationRequest raiseRequest
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4648
    ].    
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4649
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4650
    ^ debugger 
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  4651
        enter:ex suspendedContext
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  4652
        withMessage:msgString 
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  4653
        mayProceed:(ex mayProceed).
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4654
9509
bfb55a08130d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9442
diff changeset
  4655
    "Modified: / 10-08-2006 / 13:13:22 / cg"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4656
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4657
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4658
primitiveFailed
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4659
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4660
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4661
    "report an error that some primitive code failed.
8324
c6e8039f0d83 Set message as parameter in #primitiveFailed
Stefan Vogel <sv@exept.de>
parents: 8322
diff changeset
  4662
     The error is reported by raising the PrimitiveFailure exception."
c6e8039f0d83 Set message as parameter in #primitiveFailed
Stefan Vogel <sv@exept.de>
parents: 8322
diff changeset
  4663
c6e8039f0d83 Set message as parameter in #primitiveFailed
Stefan Vogel <sv@exept.de>
parents: 8322
diff changeset
  4664
    |sender|
c6e8039f0d83 Set message as parameter in #primitiveFailed
Stefan Vogel <sv@exept.de>
parents: 8322
diff changeset
  4665
c6e8039f0d83 Set message as parameter in #primitiveFailed
Stefan Vogel <sv@exept.de>
parents: 8322
diff changeset
  4666
    sender := thisContext sender.
c6e8039f0d83 Set message as parameter in #primitiveFailed
Stefan Vogel <sv@exept.de>
parents: 8322
diff changeset
  4667
c6e8039f0d83 Set message as parameter in #primitiveFailed
Stefan Vogel <sv@exept.de>
parents: 8322
diff changeset
  4668
    ^ PrimitiveFailure raiseRequestWith:(Message selector:sender selector arguments:sender args)
c6e8039f0d83 Set message as parameter in #primitiveFailed
Stefan Vogel <sv@exept.de>
parents: 8322
diff changeset
  4669
                       in:sender.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4670
6005
012813d02bf7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6000
diff changeset
  4671
    "
012813d02bf7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6000
diff changeset
  4672
     1234 primitiveFailed
8324
c6e8039f0d83 Set message as parameter in #primitiveFailed
Stefan Vogel <sv@exept.de>
parents: 8322
diff changeset
  4673
c6e8039f0d83 Set message as parameter in #primitiveFailed
Stefan Vogel <sv@exept.de>
parents: 8322
diff changeset
  4674
     [
c6e8039f0d83 Set message as parameter in #primitiveFailed
Stefan Vogel <sv@exept.de>
parents: 8322
diff changeset
  4675
        ExternalBytes new   basicAt:40
c6e8039f0d83 Set message as parameter in #primitiveFailed
Stefan Vogel <sv@exept.de>
parents: 8322
diff changeset
  4676
     ] on:PrimitiveFailure do:[:ex|
c6e8039f0d83 Set message as parameter in #primitiveFailed
Stefan Vogel <sv@exept.de>
parents: 8322
diff changeset
  4677
        ex inspect
c6e8039f0d83 Set message as parameter in #primitiveFailed
Stefan Vogel <sv@exept.de>
parents: 8322
diff changeset
  4678
     ]
c6e8039f0d83 Set message as parameter in #primitiveFailed
Stefan Vogel <sv@exept.de>
parents: 8322
diff changeset
  4679
    "
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4680
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4681
8977
fff5644c031d #primitiveFailed: remember the message implementing the failure
Stefan Vogel <sv@exept.de>
parents: 8975
diff changeset
  4682
primitiveFailed:messageString
fff5644c031d #primitiveFailed: remember the message implementing the failure
Stefan Vogel <sv@exept.de>
parents: 8975
diff changeset
  4683
    "{ Pragma: +optSpace }"
fff5644c031d #primitiveFailed: remember the message implementing the failure
Stefan Vogel <sv@exept.de>
parents: 8975
diff changeset
  4684
fff5644c031d #primitiveFailed: remember the message implementing the failure
Stefan Vogel <sv@exept.de>
parents: 8975
diff changeset
  4685
    "report an error that some primitive code failed.
fff5644c031d #primitiveFailed: remember the message implementing the failure
Stefan Vogel <sv@exept.de>
parents: 8975
diff changeset
  4686
     The error is reported by raising the PrimitiveFailureSignal exception."
fff5644c031d #primitiveFailed: remember the message implementing the failure
Stefan Vogel <sv@exept.de>
parents: 8975
diff changeset
  4687
fff5644c031d #primitiveFailed: remember the message implementing the failure
Stefan Vogel <sv@exept.de>
parents: 8975
diff changeset
  4688
    |sender|
fff5644c031d #primitiveFailed: remember the message implementing the failure
Stefan Vogel <sv@exept.de>
parents: 8975
diff changeset
  4689
fff5644c031d #primitiveFailed: remember the message implementing the failure
Stefan Vogel <sv@exept.de>
parents: 8975
diff changeset
  4690
    sender := thisContext sender.
fff5644c031d #primitiveFailed: remember the message implementing the failure
Stefan Vogel <sv@exept.de>
parents: 8975
diff changeset
  4691
fff5644c031d #primitiveFailed: remember the message implementing the failure
Stefan Vogel <sv@exept.de>
parents: 8975
diff changeset
  4692
    ^ PrimitiveFailure raiseRequestWith:(Message selector:sender selector arguments:sender args)
fff5644c031d #primitiveFailed: remember the message implementing the failure
Stefan Vogel <sv@exept.de>
parents: 8975
diff changeset
  4693
                       errorString:messageString 
fff5644c031d #primitiveFailed: remember the message implementing the failure
Stefan Vogel <sv@exept.de>
parents: 8975
diff changeset
  4694
                       in:sender.
fff5644c031d #primitiveFailed: remember the message implementing the failure
Stefan Vogel <sv@exept.de>
parents: 8975
diff changeset
  4695
fff5644c031d #primitiveFailed: remember the message implementing the failure
Stefan Vogel <sv@exept.de>
parents: 8975
diff changeset
  4696
    "
fff5644c031d #primitiveFailed: remember the message implementing the failure
Stefan Vogel <sv@exept.de>
parents: 8975
diff changeset
  4697
     1234 primitiveFailed:'this is a test'
fff5644c031d #primitiveFailed: remember the message implementing the failure
Stefan Vogel <sv@exept.de>
parents: 8975
diff changeset
  4698
    "
fff5644c031d #primitiveFailed: remember the message implementing the failure
Stefan Vogel <sv@exept.de>
parents: 8975
diff changeset
  4699
!
fff5644c031d #primitiveFailed: remember the message implementing the failure
Stefan Vogel <sv@exept.de>
parents: 8975
diff changeset
  4700
6815
71582d439a74 Define #shouldImplement
Stefan Vogel <sv@exept.de>
parents: 6805
diff changeset
  4701
shouldImplement
71582d439a74 Define #shouldImplement
Stefan Vogel <sv@exept.de>
parents: 6805
diff changeset
  4702
    "{ Pragma: +optSpace }"
71582d439a74 Define #shouldImplement
Stefan Vogel <sv@exept.de>
parents: 6805
diff changeset
  4703
71582d439a74 Define #shouldImplement
Stefan Vogel <sv@exept.de>
parents: 6805
diff changeset
  4704
    "report an error that this message should be implemented.
71582d439a74 Define #shouldImplement
Stefan Vogel <sv@exept.de>
parents: 6805
diff changeset
  4705
     This is send by automatically generated method bodies"
71582d439a74 Define #shouldImplement
Stefan Vogel <sv@exept.de>
parents: 6805
diff changeset
  4706
9216
6396192d71c6 use UnimplementedFunctionalityError in #subclassResponsibility
Stefan Vogel <sv@exept.de>
parents: 9203
diff changeset
  4707
    |sender|
6396192d71c6 use UnimplementedFunctionalityError in #subclassResponsibility
Stefan Vogel <sv@exept.de>
parents: 9203
diff changeset
  4708
6396192d71c6 use UnimplementedFunctionalityError in #subclassResponsibility
Stefan Vogel <sv@exept.de>
parents: 9203
diff changeset
  4709
    sender := thisContext sender.
6396192d71c6 use UnimplementedFunctionalityError in #subclassResponsibility
Stefan Vogel <sv@exept.de>
parents: 9203
diff changeset
  4710
6396192d71c6 use UnimplementedFunctionalityError in #subclassResponsibility
Stefan Vogel <sv@exept.de>
parents: 9203
diff changeset
  4711
    ^ UnimplementedFunctionalityError raiseRequestWith:(Message selector:sender selector arguments:sender args)
6396192d71c6 use UnimplementedFunctionalityError in #subclassResponsibility
Stefan Vogel <sv@exept.de>
parents: 9203
diff changeset
  4712
6396192d71c6 use UnimplementedFunctionalityError in #subclassResponsibility
Stefan Vogel <sv@exept.de>
parents: 9203
diff changeset
  4713
6396192d71c6 use UnimplementedFunctionalityError in #subclassResponsibility
Stefan Vogel <sv@exept.de>
parents: 9203
diff changeset
  4714
     "
6396192d71c6 use UnimplementedFunctionalityError in #subclassResponsibility
Stefan Vogel <sv@exept.de>
parents: 9203
diff changeset
  4715
        self shouldImplement
6396192d71c6 use UnimplementedFunctionalityError in #subclassResponsibility
Stefan Vogel <sv@exept.de>
parents: 9203
diff changeset
  4716
     "
6815
71582d439a74 Define #shouldImplement
Stefan Vogel <sv@exept.de>
parents: 6805
diff changeset
  4717
!
71582d439a74 Define #shouldImplement
Stefan Vogel <sv@exept.de>
parents: 6805
diff changeset
  4718
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4719
shouldNotImplement
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4720
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4721
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4722
    "report an error that this message should not be implemented"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4723
8729
2e454c09b38a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8690
diff changeset
  4724
    ^ self error:'method/functionality not appropriate for this class'
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4725
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4726
    "Modified: 8.5.1996 / 09:09:44 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4727
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4728
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4729
subclassResponsibility
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4730
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4731
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4732
    "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
  4733
     subclass"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4734
7334
7da368a2f0da *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 7322
diff changeset
  4735
    ^ SubclassResponsibilityError raiseRequest
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4736
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4737
6721
e5f47c6e2f40 #subclassResponsibility & #subclassResponsibility:
Claus Gittinger <cg@exept.de>
parents: 6718
diff changeset
  4738
subclassResponsibility:msg
e5f47c6e2f40 #subclassResponsibility & #subclassResponsibility:
Claus Gittinger <cg@exept.de>
parents: 6718
diff changeset
  4739
    "{ Pragma: +optSpace }"
e5f47c6e2f40 #subclassResponsibility & #subclassResponsibility:
Claus Gittinger <cg@exept.de>
parents: 6718
diff changeset
  4740
e5f47c6e2f40 #subclassResponsibility & #subclassResponsibility:
Claus Gittinger <cg@exept.de>
parents: 6718
diff changeset
  4741
    "report an error that this message should have been reimplemented in a subclass"
e5f47c6e2f40 #subclassResponsibility & #subclassResponsibility:
Claus Gittinger <cg@exept.de>
parents: 6718
diff changeset
  4742
7334
7da368a2f0da *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 7322
diff changeset
  4743
    ^ SubclassResponsibilityError raiseRequestErrorString:msg
6721
e5f47c6e2f40 #subclassResponsibility & #subclassResponsibility:
Claus Gittinger <cg@exept.de>
parents: 6718
diff changeset
  4744
!
e5f47c6e2f40 #subclassResponsibility & #subclassResponsibility:
Claus Gittinger <cg@exept.de>
parents: 6718
diff changeset
  4745
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4746
subscriptBoundsError
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
    "report an error that some index is out of bounds.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4750
     (when accessing indexable collections).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4751
     The error is reported by raising the SubscriptOutOfBoundsSignal exception."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4752
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4753
    ^ SubscriptOutOfBoundsSignal raiseRequestWith:nil
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4754
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4755
    "Modified: / 26.7.1996 / 16:45:42 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4756
    "Modified: / 26.7.1999 / 10:58:27 / stefan"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4757
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4758
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4759
subscriptBoundsError:anIndex
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4760
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4761
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4762
    "report an error that anIndex is out of bounds.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4763
     (when accessing indexable collections).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4764
     The error is reported by raising the SubscriptOutOfBoundsSignal exception."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4765
6221
404495587300 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6203
diff changeset
  4766
    ^ SubscriptOutOfBoundsError 
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  4767
        raiseRequestWith:anIndex 
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  4768
        errorString:('subscript (' , anIndex printString , ') out of bounds')
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4769
6221
404495587300 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6203
diff changeset
  4770
    "Modified: / 17.11.2001 / 22:49:56 / cg"
5755
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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4773
typeCheckError
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4774
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4775
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4776
    "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
  4777
     value assigned"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4778
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4779
    ^ self error:'bad assign of ' , self printString ,
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  4780
                  ' (' , self class name , ') to typed variable'
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4781
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4782
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4783
!Object methodsFor:'evaluation'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4784
8690
5894d98a4a61 Implement #argumentCount for Block-compatibility.
Stefan Vogel <sv@exept.de>
parents: 8637
diff changeset
  4785
argumentCount
5894d98a4a61 Implement #argumentCount for Block-compatibility.
Stefan Vogel <sv@exept.de>
parents: 8637
diff changeset
  4786
    "compatibility with Blocks and Messages.
5894d98a4a61 Implement #argumentCount for Block-compatibility.
Stefan Vogel <sv@exept.de>
parents: 8637
diff changeset
  4787
     Answer 0, since we only understand #value.
5894d98a4a61 Implement #argumentCount for Block-compatibility.
Stefan Vogel <sv@exept.de>
parents: 8637
diff changeset
  4788
5894d98a4a61 Implement #argumentCount for Block-compatibility.
Stefan Vogel <sv@exept.de>
parents: 8637
diff changeset
  4789
     By implementing this, you can pass any object as an exception handler."
5894d98a4a61 Implement #argumentCount for Block-compatibility.
Stefan Vogel <sv@exept.de>
parents: 8637
diff changeset
  4790
5894d98a4a61 Implement #argumentCount for Block-compatibility.
Stefan Vogel <sv@exept.de>
parents: 8637
diff changeset
  4791
    ^ 0
5894d98a4a61 Implement #argumentCount for Block-compatibility.
Stefan Vogel <sv@exept.de>
parents: 8637
diff changeset
  4792
5894d98a4a61 Implement #argumentCount for Block-compatibility.
Stefan Vogel <sv@exept.de>
parents: 8637
diff changeset
  4793
    "
5894d98a4a61 Implement #argumentCount for Block-compatibility.
Stefan Vogel <sv@exept.de>
parents: 8637
diff changeset
  4794
        [1 // 0] on:ArithmeticError do:9999
5894d98a4a61 Implement #argumentCount for Block-compatibility.
Stefan Vogel <sv@exept.de>
parents: 8637
diff changeset
  4795
    "
5894d98a4a61 Implement #argumentCount for Block-compatibility.
Stefan Vogel <sv@exept.de>
parents: 8637
diff changeset
  4796
!
5894d98a4a61 Implement #argumentCount for Block-compatibility.
Stefan Vogel <sv@exept.de>
parents: 8637
diff changeset
  4797
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4798
value
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4799
    "return the receiver itself.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4800
     This allows every object to be used where blocks or valueHolders
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4801
     are typically used, and allows for valueHolders and blocks to be
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4802
     used interchangably in some situations.
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
     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
  4805
     style ... (the idea was borrowed from the Self language).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4806
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4807
     WARNING: dont 'optimize' away ifXXX: blocks 
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  4808
              (i.e. do NOT replace 
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  4809
                        foo ifTrue:[var1] ifFalse:[var2]
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  4810
               by:
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  4811
                        foo ifTrue:var1 ifFalse:var2
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  4812
              )
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  4813
              - the compilers will only generate inline code for the if, 
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  4814
                iff the argument(s) are blocks - otherwise, a true send is
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  4815
                generated.
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  4816
              This 'oprimization' will work semantically correct,
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  4817
              but execute SLOWER instead."
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4818
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4819
    ^ self
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4820
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4821
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4822
     #(1 2 3 4) indexOf:5 ifAbsent:0     
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4823
     #(1 2 3 4) indexOf:5 ifAbsent:[0]     
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4824
     1 > 2 ifTrue:['yes'] ifFalse:['no']  
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4825
     1 > 2 ifTrue:'yes' ifFalse:'no'       
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4826
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4827
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4828
    "DO NOT DO THIS (its slower)
7458
b0ca7546cbd6 CG: comment in value
Stefan Vogel <sv@exept.de>
parents: 7455
diff changeset
  4829
     (1 > 4) ifTrue:a ifFalse:b
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4830
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4831
     USE (the compiler optimizes blocks in if/while):
7458
b0ca7546cbd6 CG: comment in value
Stefan Vogel <sv@exept.de>
parents: 7455
diff changeset
  4832
     (1 > 4) ifTrue:[a] ifFalse:[b]
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4833
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4834
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4835
    "Modified: 3.5.1996 / 11:57:08 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4836
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4837
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4838
!Object methodsFor:'finalization'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4839
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4840
disposed
6439
0f841258ec4a Use #finalize instead of #disposed
Stefan Vogel <sv@exept.de>
parents: 6421
diff changeset
  4841
    "OBSOLETE INTERFACE: use #finalize
0f841258ec4a Use #finalize instead of #disposed
Stefan Vogel <sv@exept.de>
parents: 6421
diff changeset
  4842
     this is invoked for objects which have been registered
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4843
     in a Registry, when the original object dies.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4844
     Subclasses may redefine this method"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4845
6439
0f841258ec4a Use #finalize instead of #disposed
Stefan Vogel <sv@exept.de>
parents: 6421
diff changeset
  4846
    <resource: #obsolete>
0f841258ec4a Use #finalize instead of #disposed
Stefan Vogel <sv@exept.de>
parents: 6421
diff changeset
  4847
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4848
    ^ self
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4849
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4850
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4851
executor
6439
0f841258ec4a Use #finalize instead of #disposed
Stefan Vogel <sv@exept.de>
parents: 6421
diff changeset
  4852
    "Return the object which does the finalization for me.
0f841258ec4a Use #finalize instead of #disposed
Stefan Vogel <sv@exept.de>
parents: 6421
diff changeset
  4853
     This interface is also VW & Sqeak compatible,"
0f841258ec4a Use #finalize instead of #disposed
Stefan Vogel <sv@exept.de>
parents: 6421
diff changeset
  4854
0f841258ec4a Use #finalize instead of #disposed
Stefan Vogel <sv@exept.de>
parents: 6421
diff changeset
  4855
    "for now, send #shallowCopyForFinalization, to be compatible with
0f841258ec4a Use #finalize instead of #disposed
Stefan Vogel <sv@exept.de>
parents: 6421
diff changeset
  4856
     classes designed for old ST/X versions"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4857
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4858
    ^ self shallowCopyForFinalization
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4859
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4860
6461
f5efaff3457b Allow #registerForFinalization for classes defining their own Lobby.
Stefan Vogel <sv@exept.de>
parents: 6439
diff changeset
  4861
finalizationLobby
f5efaff3457b Allow #registerForFinalization for classes defining their own Lobby.
Stefan Vogel <sv@exept.de>
parents: 6439
diff changeset
  4862
    "answer a Registry used for finalization.
f5efaff3457b Allow #registerForFinalization for classes defining their own Lobby.
Stefan Vogel <sv@exept.de>
parents: 6439
diff changeset
  4863
     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
  4864
     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
  4865
f5efaff3457b Allow #registerForFinalization for classes defining their own Lobby.
Stefan Vogel <sv@exept.de>
parents: 6439
diff changeset
  4866
    ^ FinalizationLobby
f5efaff3457b Allow #registerForFinalization for classes defining their own Lobby.
Stefan Vogel <sv@exept.de>
parents: 6439
diff changeset
  4867
!
f5efaff3457b Allow #registerForFinalization for classes defining their own Lobby.
Stefan Vogel <sv@exept.de>
parents: 6439
diff changeset
  4868
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4869
finalize
6439
0f841258ec4a Use #finalize instead of #disposed
Stefan Vogel <sv@exept.de>
parents: 6421
diff changeset
  4870
    "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
  4871
     in a Registry, when the original object dies.
0f841258ec4a Use #finalize instead of #disposed
Stefan Vogel <sv@exept.de>
parents: 6421
diff changeset
  4872
     Subclasses may redefine this method
0f841258ec4a Use #finalize instead of #disposed
Stefan Vogel <sv@exept.de>
parents: 6421
diff changeset
  4873
     This interface is also VW-compatible"
0f841258ec4a Use #finalize instead of #disposed
Stefan Vogel <sv@exept.de>
parents: 6421
diff changeset
  4874
0f841258ec4a Use #finalize instead of #disposed
Stefan Vogel <sv@exept.de>
parents: 6421
diff changeset
  4875
    "send #disposed for compatibility with existing classes that still
0f841258ec4a Use #finalize instead of #disposed
Stefan Vogel <sv@exept.de>
parents: 6421
diff changeset
  4876
     implement the obsolete #disposed message"
0f841258ec4a Use #finalize instead of #disposed
Stefan Vogel <sv@exept.de>
parents: 6421
diff changeset
  4877
0f841258ec4a Use #finalize instead of #disposed
Stefan Vogel <sv@exept.de>
parents: 6421
diff changeset
  4878
    ^ self disposed
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4879
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4880
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4881
reRegisterForFinalization
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4882
    "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
  4883
     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
  4884
     the receiver is garbage collected."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4885
6461
f5efaff3457b Allow #registerForFinalization for classes defining their own Lobby.
Stefan Vogel <sv@exept.de>
parents: 6439
diff changeset
  4886
    self finalizationLobby registerChange:self
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4887
!
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
registerForFinalization
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4890
    "register mySelf for later finalization.
6461
f5efaff3457b Allow #registerForFinalization for classes defining their own Lobby.
Stefan Vogel <sv@exept.de>
parents: 6439
diff changeset
  4891
     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
  4892
     the receiver is garbage collected."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4893
6461
f5efaff3457b Allow #registerForFinalization for classes defining their own Lobby.
Stefan Vogel <sv@exept.de>
parents: 6439
diff changeset
  4894
    self finalizationLobby register:self
f5efaff3457b Allow #registerForFinalization for classes defining their own Lobby.
Stefan Vogel <sv@exept.de>
parents: 6439
diff changeset
  4895
!
f5efaff3457b Allow #registerForFinalization for classes defining their own Lobby.
Stefan Vogel <sv@exept.de>
parents: 6439
diff changeset
  4896
f5efaff3457b Allow #registerForFinalization for classes defining their own Lobby.
Stefan Vogel <sv@exept.de>
parents: 6439
diff changeset
  4897
shallowCopyForFinalization
f5efaff3457b Allow #registerForFinalization for classes defining their own Lobby.
Stefan Vogel <sv@exept.de>
parents: 6439
diff changeset
  4898
    "OBSOLETE INTERFACE: use #executor.
f5efaff3457b Allow #registerForFinalization for classes defining their own Lobby.
Stefan Vogel <sv@exept.de>
parents: 6439
diff changeset
  4899
     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
  4900
     (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
  4901
     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
  4902
f5efaff3457b Allow #registerForFinalization for classes defining their own Lobby.
Stefan Vogel <sv@exept.de>
parents: 6439
diff changeset
  4903
    <resource: #obsolete>
f5efaff3457b Allow #registerForFinalization for classes defining their own Lobby.
Stefan Vogel <sv@exept.de>
parents: 6439
diff changeset
  4904
f5efaff3457b Allow #registerForFinalization for classes defining their own Lobby.
Stefan Vogel <sv@exept.de>
parents: 6439
diff changeset
  4905
    ^ self shallowCopy
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4906
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4907
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4908
unregisterForFinalization
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4909
    "unregister mySelf from later finalization"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4910
6461
f5efaff3457b Allow #registerForFinalization for classes defining their own Lobby.
Stefan Vogel <sv@exept.de>
parents: 6439
diff changeset
  4911
    self finalizationLobby unregister:self
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4912
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4913
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4914
!Object methodsFor:'initialization'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4915
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4916
initialize
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4917
    "just to ignore initialize to objects which do not need it"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4918
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4919
    ^ self
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4920
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4921
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4922
!Object methodsFor:'interrupt handling'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4923
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4924
childSignalInterrupt
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4925
    "death of a child process (unix process) - do nothing"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4926
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4927
    ^ self
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4928
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4929
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4930
customInterrupt
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4931
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4932
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4933
    "a custom interrupt - but no handler has defined"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4934
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4935
    self error:'custom interrupt' mayProceed:true
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4936
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4937
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4938
errorInterrupt:errorID with:aParameter
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4939
    "subsystem error. The arguments errorID and aParameter are the values passed
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4940
     to the 'errorInterruptWithIDAndParameter(id, param)' function, 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4941
     which can be called from C subsystems to raise an (asynchronous)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4942
     error exception.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4943
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4944
     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
  4945
     used from other C subsystems too, to upcast errors.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4946
     Especially, for subsystems which call errorHandler functions asynchronously.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4947
     IDs (currently) used:
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  4948
        #DisplayError ..... x-error interrupt
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  4949
        #XtError      ..... xt-error interrupt (Xt interface is not yet published)
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4950
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4951
6263
4e7a970e4cfc errorInterrupt:with: fixed (care for nil handlers in Objmem)
Claus Gittinger <cg@exept.de>
parents: 6235
diff changeset
  4952
    |handlers handler|
4e7a970e4cfc errorInterrupt:with: fixed (care for nil handlers in Objmem)
Claus Gittinger <cg@exept.de>
parents: 6235
diff changeset
  4953
4e7a970e4cfc errorInterrupt:with: fixed (care for nil handlers in Objmem)
Claus Gittinger <cg@exept.de>
parents: 6235
diff changeset
  4954
    handlers := ObjectMemory registeredErrorInterruptHandlers.
4e7a970e4cfc errorInterrupt:with: fixed (care for nil handlers in Objmem)
Claus Gittinger <cg@exept.de>
parents: 6235
diff changeset
  4955
    handlers notNil ifTrue:[
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  4956
        handler := handlers at:errorID ifAbsent:nil.
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  4957
        handler notNil ifTrue:[
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  4958
            "/
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  4959
            "/ handler found; let it do whatever it wants ...
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  4960
            "/
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  4961
            handler errorInterrupt:errorID with:aParameter.
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  4962
            ^ self
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  4963
        ].
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4964
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4965
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4966
    "/
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4967
    "/ no handler - raise errorSignal passing the errorId as parameter
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4968
    "/
7094
617eeaf2f8ba Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7081
diff changeset
  4969
    ^ Error 
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  4970
        raiseRequestWith:errorID 
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  4971
        errorString:('Subsystem error. ErrorID = ' , errorID printString)
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4972
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4973
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4974
exceptionInterrupt
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4975
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4976
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4977
    "exception interrupt - enter debugger"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4978
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4979
    self error:'exception Interrupt' mayProceed:true
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4980
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4981
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4982
fpExceptionInterrupt
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4983
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4984
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4985
    "a floating point exception occured - this one
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4986
     has to be handled differently since it comes asynchronous
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4987
     on some machines (for example, on machines with a separate FPU
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4988
     or superscalar architectures. Also, errors from within primitive code
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4989
     (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
  4990
     mechanism this way."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4991
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4992
    |where rec|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4993
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4994
    where := thisContext sender.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4995
    rec := where receiver.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4996
    rec isNumber ifTrue:[
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  4997
        ^ rec class
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  4998
            raise:#domainErrorSignal
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  4999
            receiver:rec
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5000
            selector:where selector
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5001
            arguments:(where args asArray)
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5002
            errorString:'floating point exception'
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5003
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5004
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5005
    "/ could be in some C-library ...
7402
b9d45ce2463a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7359
diff changeset
  5006
    ^ DomainError raise
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5007
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5008
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5009
internalError:msg
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5010
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5011
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5012
    "this is triggered, when VM hits some bad error,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5013
     such as corrupted class, corrupted method/selector array
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5014
     etc. The argument string gives some more information on what happened.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5015
     (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
  5016
     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
  5017
     this error occurred ...."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5018
8330
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
  5019
    VMInternalError raiseWith:self errorString:msg
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5020
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5021
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5022
ioInterrupt
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5023
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5024
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5025
    "I/O (SIGIO/SIGPOLL) interrupt (supposed to be sent to Processor).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5026
     If we arrive here, there is either no handler (ObjMem>>ioInterruptHandler)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5027
     or it does not understand the ioInterrupt message.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5028
     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
  5029
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5030
    self error:'I/O Interrupt - but no handler' mayProceed:true
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5031
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5032
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5033
memoryInterrupt
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5034
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5035
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5036
    "out-of-memory interrupt and no handler - enter debugger"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5037
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5038
    self error:'almost out of memory' mayProceed:true
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5039
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5040
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5041
recursionInterrupt
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5042
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5043
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5044
    "recursion limit (actually: stack overflow) interrupt.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5045
     This interrupt is triggered, when a process stack grows above
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5046
     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
  5047
     could be caught.
e9970db3e02f recursionInterrupt fixes for win32 (& comment changed)
Claus Gittinger <cg@exept.de>
parents: 6157
diff changeset
  5048
     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
  5049
     and the exception can be resumed.
e9970db3e02f recursionInterrupt fixes for win32 (& comment changed)
Claus Gittinger <cg@exept.de>
parents: 6157
diff changeset
  5050
     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
  5051
     is not proceedable.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5052
     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
  5053
     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
  5054
     or debug for a while.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5055
     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
  5056
     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
  5057
     terminates the process."
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5058
7838
4cf3d0dad430 skip recursive contexts when shwing backtrace of recursionInterrupt
Claus Gittinger <cg@exept.de>
parents: 7685
diff changeset
  5059
    |con remaining sender nSkipped|
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5060
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5061
    (con := thisContext) isRecursive ifFalse:[
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5062
"/        Processor activeProcess usedStackSize < Processor activeProcess maximumStackSize ifTrue:[
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5063
"/            "/ mhmh - it hit me, but I am not responsible ...
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5064
"/            'Stray recursionInterrupt ...' infoPrintCR.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5065
"/            ^ self
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5066
"/        ].
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5067
        ObjectMemory infoPrinting ifTrue:[
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5068
            'Object [info]: recursionInterrupt from:' printCR.
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5069
            con := con sender.
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5070
            remaining := 50.
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5071
            [con notNil and:[remaining > 0]] whileTrue:[
7838
4cf3d0dad430 skip recursive contexts when shwing backtrace of recursionInterrupt
Claus Gittinger <cg@exept.de>
parents: 7685
diff changeset
  5072
                sender := con sender.
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5073
                '| ' print. con fullPrint.
7838
4cf3d0dad430 skip recursive contexts when shwing backtrace of recursionInterrupt
Claus Gittinger <cg@exept.de>
parents: 7685
diff changeset
  5074
4cf3d0dad430 skip recursive contexts when shwing backtrace of recursionInterrupt
Claus Gittinger <cg@exept.de>
parents: 7685
diff changeset
  5075
                nSkipped := 0.    
4cf3d0dad430 skip recursive contexts when shwing backtrace of recursionInterrupt
Claus Gittinger <cg@exept.de>
parents: 7685
diff changeset
  5076
                [sender notNil and:[sender sender notNil 
4cf3d0dad430 skip recursive contexts when shwing backtrace of recursionInterrupt
Claus Gittinger <cg@exept.de>
parents: 7685
diff changeset
  5077
                and:[sender selector == con selector
4cf3d0dad430 skip recursive contexts when shwing backtrace of recursionInterrupt
Claus Gittinger <cg@exept.de>
parents: 7685
diff changeset
  5078
                and:[sender sender selector == con selector
4cf3d0dad430 skip recursive contexts when shwing backtrace of recursionInterrupt
Claus Gittinger <cg@exept.de>
parents: 7685
diff changeset
  5079
                and:[sender method == con method]]]]] whileTrue:[
4cf3d0dad430 skip recursive contexts when shwing backtrace of recursionInterrupt
Claus Gittinger <cg@exept.de>
parents: 7685
diff changeset
  5080
                    nSkipped := nSkipped + 1.    
4cf3d0dad430 skip recursive contexts when shwing backtrace of recursionInterrupt
Claus Gittinger <cg@exept.de>
parents: 7685
diff changeset
  5081
                    con := sender.
4cf3d0dad430 skip recursive contexts when shwing backtrace of recursionInterrupt
Claus Gittinger <cg@exept.de>
parents: 7685
diff changeset
  5082
                    sender := con sender.
4cf3d0dad430 skip recursive contexts when shwing backtrace of recursionInterrupt
Claus Gittinger <cg@exept.de>
parents: 7685
diff changeset
  5083
                ].
4cf3d0dad430 skip recursive contexts when shwing backtrace of recursionInterrupt
Claus Gittinger <cg@exept.de>
parents: 7685
diff changeset
  5084
                nSkipped > 0 ifTrue:[
4cf3d0dad430 skip recursive contexts when shwing backtrace of recursionInterrupt
Claus Gittinger <cg@exept.de>
parents: 7685
diff changeset
  5085
                    '| ... ***** ' print. nSkipped print. ' recursive contexts skipped *****' printCR.
4cf3d0dad430 skip recursive contexts when shwing backtrace of recursionInterrupt
Claus Gittinger <cg@exept.de>
parents: 7685
diff changeset
  5086
                ].
4cf3d0dad430 skip recursive contexts when shwing backtrace of recursionInterrupt
Claus Gittinger <cg@exept.de>
parents: 7685
diff changeset
  5087
                con := sender.
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5088
                remaining := remaining - 1
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5089
            ].
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5090
        ].
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5091
        ^ RecursionInterruptSignal raiseSignal
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5092
    ]
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5093
6175
e9970db3e02f recursionInterrupt fixes for win32 (& comment changed)
Claus Gittinger <cg@exept.de>
parents: 6157
diff changeset
  5094
    "Modified: / 10.11.2001 / 15:15:56 / cg"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5095
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5096
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5097
schedulerInterrupt
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5098
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5099
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5100
    "scheduler interrupt (supposed to be sent to Processor).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5101
     If we arrive here, either the Processor does not understand it,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5102
     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
  5103
     big trouble. Enter debugger."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5104
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5105
    self error:'schedulerInterrupt - but no Processor' mayProceed:true
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5106
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5107
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5108
signalInterrupt:signalNumber
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5109
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5110
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5111
    "unix signal occured - some signals are handled as Smalltalk Exceptions 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5112
     (SIGPIPE), others (SIGBUS) are rather fatal ...
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5113
     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
  5114
     that one is raised.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5115
     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
  5116
     signal.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5117
     TODO: add another argument, giving more detailed signal info (PC, VADDR,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5118
     exact cause etc.). This helps if segvs occur in primitive code.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5119
     Currently (temporary kludge), these are passed as global variables."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5120
6537
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  5121
    |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
  5122
     action title screen|
41396e0cc89f Fix #signalInterrupt: for multi-display and headless.
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
  5123
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5124
    "if there has been an ST-signal installed, use it ..."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5125
    sig := OperatingSystem operatingSystemSignal:signalNumber.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5126
    sig notNil ifTrue:[
8324
c6e8039f0d83 Set message as parameter in #primitiveFailed
Stefan Vogel <sv@exept.de>
parents: 8322
diff changeset
  5127
        sig raiseSignalWith:signalNumber.
6537
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  5128
        ^ self.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5129
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5130
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5131
    "/ if handled, raise OSSignalInterruptSignal
8330
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
  5132
    OSSignalInterrupt isHandled ifTrue:[
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
  5133
        OSSignalInterrupt raiseRequestWith:signalNumber.
6537
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  5134
        ^ self.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5135
    ].
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
    "
8324
c6e8039f0d83 Set message as parameter in #primitiveFailed
Stefan Vogel <sv@exept.de>
parents: 8322
diff changeset
  5138
     special case - SIGPWR: power failure - write a crash image and continue
c6e8039f0d83 Set message as parameter in #primitiveFailed
Stefan Vogel <sv@exept.de>
parents: 8322
diff changeset
  5139
                  - SIGHUP: hang up - write a crash image and exit
7031
eae2df0a3ad2 Exit Smalltalk in SIGHUP
Stefan Vogel <sv@exept.de>
parents: 6964
diff changeset
  5140
    "
eae2df0a3ad2 Exit Smalltalk in SIGHUP
Stefan Vogel <sv@exept.de>
parents: 6964
diff changeset
  5141
    signalNumber == 30 "OperatingSystem sigPWR"  ifTrue:[
8806
03e74cded971 Make snapshot writing more robust against errors.
Stefan Vogel <sv@exept.de>
parents: 8798
diff changeset
  5142
        [ObjectMemory snapShotOn:'crash.img'] on:SnapshotError do:[:ex| ].
6537
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  5143
        ^ self.
5856
6d3df9ad361e save crash image when sigPWR or sigHUP arrives
Claus Gittinger <cg@exept.de>
parents: 5824
diff changeset
  5144
    ].
7031
eae2df0a3ad2 Exit Smalltalk in SIGHUP
Stefan Vogel <sv@exept.de>
parents: 6964
diff changeset
  5145
    (signalNumber == 1 "OperatingSystem sigHUP") ifTrue:[
8806
03e74cded971 Make snapshot writing more robust against errors.
Stefan Vogel <sv@exept.de>
parents: 8798
diff changeset
  5146
        [ObjectMemory snapShotOn:'crash.img'] on:SnapshotError do:[:ex| ].
03e74cded971 Make snapshot writing more robust against errors.
Stefan Vogel <sv@exept.de>
parents: 8798
diff changeset
  5147
        Smalltalk exit:1.
7031
eae2df0a3ad2 Exit Smalltalk in SIGHUP
Stefan Vogel <sv@exept.de>
parents: 6964
diff changeset
  5148
    ].
5856
6d3df9ad361e save crash image when sigPWR or sigHUP arrives
Claus Gittinger <cg@exept.de>
parents: 5824
diff changeset
  5149
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5150
    name := OperatingSystem nameForSignal:signalNumber.
6388
41396e0cc89f Fix #signalInterrupt: for multi-display and headless.
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
  5151
41396e0cc89f Fix #signalInterrupt: for multi-display and headless.
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
  5152
    "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
  5153
    (Screen isNil 
41396e0cc89f Fix #signalInterrupt: for multi-display and headless.
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
  5154
     or:[(screen := Screen current) isNil
6778
87e2d95ce8a4 Raise #drawingOnClosedDeviceSignal instead of #error
Stefan Vogel <sv@exept.de>
parents: 6764
diff changeset
  5155
     or:[(screen := Screen default) isNil
87e2d95ce8a4 Raise #drawingOnClosedDeviceSignal instead of #error
Stefan Vogel <sv@exept.de>
parents: 6764
diff changeset
  5156
     or:[screen isOpen not]]]) ifTrue:[
8324
c6e8039f0d83 Set message as parameter in #primitiveFailed
Stefan Vogel <sv@exept.de>
parents: 8322
diff changeset
  5157
        ^ self startMiniDebuggerOrExit:'OS-Signal (' , name, ')'.
6388
41396e0cc89f Fix #signalInterrupt: for multi-display and headless.
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
  5158
    ].
41396e0cc89f Fix #signalInterrupt: for multi-display and headless.
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
  5159
41396e0cc89f Fix #signalInterrupt: for multi-display and headless.
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
  5160
    "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
  5161
     otherwise display stays locked"
41396e0cc89f Fix #signalInterrupt: for multi-display and headless.
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
  5162
    screen ungrabPointer; ungrabKeyboard.
41396e0cc89f Fix #signalInterrupt: for multi-display and headless.
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
  5163
7031
eae2df0a3ad2 Exit Smalltalk in SIGHUP
Stefan Vogel <sv@exept.de>
parents: 6964
diff changeset
  5164
    here := thisContext.
eae2df0a3ad2 Exit Smalltalk in SIGHUP
Stefan Vogel <sv@exept.de>
parents: 6964
diff changeset
  5165
    badContext := here sender.          "the context, in which the signal occurred"
eae2df0a3ad2 Exit Smalltalk in SIGHUP
Stefan Vogel <sv@exept.de>
parents: 6964
diff changeset
  5166
6388
41396e0cc89f Fix #signalInterrupt: for multi-display and headless.
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
  5167
    "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
  5168
    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
  5169
        "
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  5170
         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
  5171
         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
  5172
         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
  5173
        "
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  5174
        fatal := OperatingSystem isFatalSignal:signalNumber.
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  5175
        fatal ifTrue:[
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  5176
            (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
  5177
                'Object [hard error]: signal ' errorPrint. signalNumber errorPrintCR.
8324
c6e8039f0d83 Set message as parameter in #primitiveFailed
Stefan Vogel <sv@exept.de>
parents: 8322
diff changeset
  5178
                ^ self startMiniDebuggerOrExit:'OS-Signal (' , name, ')'.
6537
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  5179
            ].
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  5180
            "
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  5181
             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
  5182
            "
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  5183
            msg := 'OS-signal: ', name.
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  5184
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  5185
            "/ 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
  5186
            "/ 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
  5187
            "/ 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
  5188
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  5189
            InterruptPcLow notNil ifTrue:[
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  5190
                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
  5191
                pc ~~ 0 ifTrue:[
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  5192
                    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
  5193
                ].
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  5194
            ].
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  5195
            InterruptAddrLow notNil ifTrue:[
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  5196
                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
  5197
                addr ~~ 0 ifTrue:[
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  5198
                    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
  5199
                ].
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  5200
            ].
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  5201
            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
  5202
            "unreachable"
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  5203
            ^ nil.
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  5204
        ].
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  5205
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  5206
        "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
  5207
         Otherwise, start a debugger"
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  5208
        Dialog notNil ifTrue:[
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  5209
            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
  5210
            actions := #(save core exit debug).
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  5211
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  5212
            action := nil.
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  5213
            title := 'OS Signal caught (' , name, ')'.
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  5214
            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
  5215
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  5216
            "/ 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
  5217
            "/ 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
  5218
            "/ (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
  5219
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  5220
            Processor activeProcess isSystemProcess ifFalse:[
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  5221
                titles := #('abort') , titles.
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  5222
                actions := #(abort), actions. 
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  5223
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  5224
                badContext canReturn ifTrue:[
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  5225
                    titles := #('return') , titles.
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  5226
                    actions :=  #(return), actions.
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  5227
                ].
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  5228
            ].
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  5229
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  5230
            fatal ifFalse:[
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  5231
                titles := titles, #('ignore').
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  5232
                actions := actions , #(ignore).
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  5233
            ].
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  5234
            action := Dialog choose:title
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  5235
                             labels:titles
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  5236
                             values:actions
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  5237
                             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
  5238
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  5239
            "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
  5240
            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
  5241
        ] ifFalse:[
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  5242
            action := #debug.
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  5243
        ].
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  5244
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  5245
        action == #save ifTrue:[
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  5246
            ObjectMemory snapShotOn:'crash.img'
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  5247
        ].
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  5248
        action == #core ifTrue:[
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  5249
            Smalltalk fatalAbort
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  5250
        ].
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  5251
        action == #exit ifTrue:[
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  5252
            Smalltalk exit
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  5253
        ].
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  5254
        action == #return ifTrue:[
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  5255
            badContext return
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  5256
        ].
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  5257
        action == #abort ifTrue:[
8324
c6e8039f0d83 Set message as parameter in #primitiveFailed
Stefan Vogel <sv@exept.de>
parents: 8322
diff changeset
  5258
            AbortOperationRequest raise.
6537
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  5259
        ].
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  5260
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  5261
        action == #debug ifTrue:[
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  5262
            Debugger isNil ifTrue:[
8324
c6e8039f0d83 Set message as parameter in #primitiveFailed
Stefan Vogel <sv@exept.de>
parents: 8322
diff changeset
  5263
                ^ self startMiniDebuggerOrExit:'OS-Signal (' , name, ')'.
6537
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  5264
            ].
8324
c6e8039f0d83 Set message as parameter in #primitiveFailed
Stefan Vogel <sv@exept.de>
parents: 8322
diff changeset
  5265
            Debugger enter:here withMessage:('OS-Signal ', name) mayProceed:true. 
6537
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  5266
        ].
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  5267
        "action == #ignore"
6388
41396e0cc89f Fix #signalInterrupt: for multi-display and headless.
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
  5268
    ].
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
spyInterrupt
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5272
    "{ Pragma: +optSpace }"
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
    "spy interrupt and no handler - enter debugger"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5275
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5276
    self error:'spy Interrupt - but no handler' mayProceed:true
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
6388
41396e0cc89f Fix #signalInterrupt: for multi-display and headless.
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
  5279
startMiniDebuggerOrExit:text
41396e0cc89f Fix #signalInterrupt: for multi-display and headless.
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
  5280
    "some critical condition happened.
41396e0cc89f Fix #signalInterrupt: for multi-display and headless.
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
  5281
     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
  5282
41396e0cc89f Fix #signalInterrupt: for multi-display and headless.
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
  5283
    MiniDebugger isNil ifTrue:[
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5284
        "a system without debugging facilities (i.e. a standalone system)
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5285
         output a message and exit."
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5286
        ('Object [error]: exit due to ', text, ' - and no debugger.') errorPrintCR.
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5287
        OperatingSystem exit:99.
6388
41396e0cc89f Fix #signalInterrupt: for multi-display and headless.
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
  5288
    ].
41396e0cc89f Fix #signalInterrupt: for multi-display and headless.
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
  5289
    MiniDebugger enterWithMessage:text mayProceed:true.
41396e0cc89f Fix #signalInterrupt: for multi-display and headless.
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
  5290
!
41396e0cc89f Fix #signalInterrupt: for multi-display and headless.
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
  5291
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5292
timerInterrupt
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5293
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5294
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5295
    "timer interrupt and no handler - enter debugger"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5296
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5297
    self error:'timer Interrupt - but no handler' mayProceed:true
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5298
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5299
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5300
userInterrupt
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5301
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5302
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5303
    "user (^c) interrupt.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5304
     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
  5305
     controlling tty (i.e. in the xterm)."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5306
6466
ae28dd895a58 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6461
diff changeset
  5307
    UserInterruptSignal raiseRequest
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5308
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5309
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5310
userInterruptIn:aContext
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5311
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5312
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5313
    "user (^c) interrupt - enter debugger, but show aContext
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5314
     as top-context. 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5315
     This is used to hide any intermediate scheduler contexts, 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5316
     in case of an interrupted process. Typically, this is sent by
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5317
     the WindowGroup, when a keyboardEvent for the ctrl-C key is
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5318
     processed."
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
    <context: #return>
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
    UserInterruptSignal raiseRequestWith:nil errorString:nil in:aContext
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5323
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5324
    "Created: / 18.10.1996 / 20:46:04 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5325
    "Modified: / 20.10.1996 / 13:06:38 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5326
    "Modified: / 26.7.1999 / 10:58:49 / stefan"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5327
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5328
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5329
!Object methodsFor:'message sending'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5330
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5331
perform:aSelector
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5332
    "send the message aSelector to the receiver"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5333
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5334
%{
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5335
    REGISTER OBJ sel = aSelector;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5336
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5337
    if (InterruptPending == nil) {
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5338
        struct inlineCache *pIlc;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5339
        static struct inlineCache ilc_0 = __ILCPERF0(@line);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5340
        static struct inlineCache ilc_1 = __ILCPERF0(@line);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5341
        static struct inlineCache ilc_2 = __ILCPERF0(@line);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5342
        static struct inlineCache ilc_3 = __ILCPERF0(@line);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5343
        static struct inlineCache ilc_4 = __ILCPERF0(@line);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5344
        static OBJ last_0 = nil;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5345
        static OBJ last_1 = nil;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5346
        static OBJ last_2 = nil;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5347
        static OBJ last_3 = nil;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5348
        static OBJ last_4 = nil;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5349
        static flip = 0;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5350
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5351
        if (sel == last_0) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5352
            pIlc = &ilc_0;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5353
        } else if (sel == last_1) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5354
            pIlc = &ilc_1;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5355
        } else if (sel == last_2) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5356
            pIlc = &ilc_2;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5357
        } else if (sel == last_3) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5358
            pIlc = &ilc_3;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5359
        } else if (sel == last_4) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5360
            pIlc = &ilc_4;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5361
        } else {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5362
            if (flip == 0) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5363
                pIlc = &ilc_0;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5364
                flip = 1;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5365
                last_0 = sel;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5366
            } else if (flip == 1) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5367
                pIlc = &ilc_1;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5368
                flip = 2;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5369
                last_1 = sel;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5370
            } else if (flip == 2) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5371
                pIlc = &ilc_2;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5372
                flip = 3;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5373
                last_2 = sel;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5374
            } else if (flip == 3) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5375
                pIlc = &ilc_3;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5376
                flip = 4;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5377
                last_3 = sel;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5378
            } else {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5379
                pIlc = &ilc_4;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5380
                flip = 0;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5381
                last_4 = sel;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5382
            }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5383
            pIlc->ilc_func = __SEND0ADDR__;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5384
            if (pIlc->ilc_poly) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5385
                __flushPolyCache(pIlc->ilc_poly);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5386
                pIlc->ilc_poly = 0;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5387
            }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5388
        }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5389
        RETURN ( (*(pIlc->ilc_func))(self, sel, nil, pIlc) );
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5390
    } else {
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5391
        static struct inlineCache ilc0 = __DUMMYILCSELF0(@line+1);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5392
        RETURN (_SEND0(self, aSelector, nil, &ilc0));
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5393
    }
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5394
%}.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5395
    ^ self perform:aSelector withArguments:#()
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5396
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5397
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5398
perform:aSelector inClass:aClass withArguments:argArray
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5399
    "send the message aSelector with all args taken from argArray 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5400
     to the receiver as a super-send message.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5401
     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
  5402
     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
  5403
     immediate superclass).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5404
     Thus, it is (theoretically) possible to do 
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5405
         '5 perform:#< inClass:Magnitude withArguments:#(6)'
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5406
     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
  5407
     This method is used by the interpreter to evaluate super sends
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5408
     and could be used for very special behavior (language extension ?).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5409
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5410
     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
  5411
5769
8f874be55bc9 lookup-class check in #perform:inClass was too strong.
Claus Gittinger <cg@exept.de>
parents: 5755
diff changeset
  5412
    |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
  5413
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5414
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5415
     check, if aClass is really a superclass of the receiver
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5416
    "
5769
8f874be55bc9 lookup-class check in #perform:inClass was too strong.
Claus Gittinger <cg@exept.de>
parents: 5755
diff changeset
  5417
    myClass := self class.
8f874be55bc9 lookup-class check in #perform:inClass was too strong.
Claus Gittinger <cg@exept.de>
parents: 5755
diff changeset
  5418
    (myClass == aClass or:[myClass isSubclassOf:aClass]) ifFalse:[
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5419
        self error:'lookup-class argument is not a superclass of the receiver'.
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5420
        ^ nil
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5421
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5422
%{
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5423
    REGISTER OBJ *argP;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5424
    int nargs, i;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5425
8934
32a063645991 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8930
diff changeset
  5426
    if (__isArrayLike(argArray)) {
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5427
        nargs = __arraySize(argArray);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5428
        argP = __arrayVal(argArray);
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5429
    } else {
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5430
        if (__isNonNilObject(argArray)) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5431
            static struct inlineCache ilcSize = __ILC0(@line+1);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5432
            numberOfArgs = (*ilcSize.ilc_func)(argArray, @symbol(size), nil, &ilcSize); 
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5433
            if (!__isSmallInteger(numberOfArgs)) 
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5434
                goto bad;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5435
            nargs = __intVal(numberOfArgs);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5436
            argP = (OBJ *)(&a1);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5437
            for (i=1; i <= nargs; i++) {
8913
b9498d27a554 64bit; mkSmallInteger
Claus Gittinger <cg@exept.de>
parents: 8909
diff changeset
  5438
                *argP++ = __AT_(argArray, __mkSmallInteger(i));
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5439
            }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5440
            argP = (OBJ *)(&a1);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5441
        } else {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5442
            nargs = 0;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5443
        }
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5444
    }
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5445
    switch (nargs) {
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5446
        case 0:
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5447
            {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5448
                static struct inlineCache ilc0 = __DUMMYILCSELF0(@line+1);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5449
                RETURN ( _SEND0(self, aSelector, aClass, &ilc0));
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5450
            }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5451
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5452
        case 1: 
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5453
            {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5454
                static struct inlineCache ilc1 = __DUMMYILCSELF1(@line+1);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5455
                RETURN ( _SEND1(self, aSelector, aClass, &ilc1, argP[0]));
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5456
            }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5457
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5458
        case 2: 
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5459
            {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5460
                static struct inlineCache ilc2 = __DUMMYILCSELF2(@line+1);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5461
                RETURN ( _SEND2(self, aSelector, aClass, &ilc2, argP[0], argP[1]));
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5462
            }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5463
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5464
        case 3: 
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5465
            {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5466
                static struct inlineCache ilc3 = __DUMMYILCSELF3(@line+1);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5467
                RETURN ( _SEND3(self, aSelector, aClass, &ilc3, 
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5468
                                argP[0], argP[1], argP[2]));
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5469
            }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5470
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5471
        case 4: 
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5472
            {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5473
                static struct inlineCache ilc4 = __DUMMYILCSELF4(@line+1);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5474
                RETURN ( _SEND4(self, aSelector, aClass, &ilc4,
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5475
                                argP[0], argP[1], argP[2], argP[3]));
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5476
            }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5477
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5478
        case 5: 
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5479
            {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5480
                static struct inlineCache ilc5 = __DUMMYILCSELF5(@line+1);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5481
                RETURN ( _SEND5(self, aSelector, aClass, &ilc5, 
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5482
                                argP[0], argP[1], argP[2], argP[3], argP[4]));
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5483
            }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5484
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5485
        case 6: 
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5486
            {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5487
                static struct inlineCache ilc6 = __DUMMYILCSELF6(@line+1);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5488
                RETURN ( _SEND6(self, aSelector, aClass, &ilc6, 
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5489
                                argP[0], argP[1], argP[2], argP[3], argP[4], argP[5]));
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5490
            }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5491
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5492
        case 7: 
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5493
            {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5494
                static struct inlineCache ilc7 = __DUMMYILCSELF7(@line+1);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5495
                RETURN ( _SEND7(self, aSelector, aClass, &ilc7, 
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5496
                                argP[0], argP[1], argP[2], argP[3], argP[4], argP[5], 
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5497
                                argP[6]));
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5498
            }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5499
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5500
        case 8: 
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5501
            {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5502
                static struct inlineCache ilc8 = __DUMMYILCSELF8(@line+1);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5503
                RETURN ( _SEND8(self, aSelector, aClass, &ilc8, 
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5504
                                argP[0], argP[1], argP[2], argP[3], argP[4], argP[5], 
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5505
                                argP[6], argP[7]));
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5506
            }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5507
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5508
        case 9: 
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5509
            {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5510
                static struct inlineCache ilc9 = __DUMMYILCSELF9(@line+1);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5511
                RETURN ( _SEND9(self, aSelector, aClass, &ilc9, 
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5512
                                argP[0], argP[1], argP[2], argP[3], argP[4], argP[5], 
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5513
                                argP[6], argP[7], argP[8]));
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5514
            }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5515
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5516
        case 10: 
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5517
            {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5518
                static struct inlineCache ilc10 = __DUMMYILCSELF10(@line+1);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5519
                RETURN ( _SEND10(self, aSelector, aClass, &ilc10, 
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5520
                                 argP[0], argP[1], argP[2], argP[3], argP[4], argP[5], 
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5521
                                 argP[6], argP[7], argP[8], argP[9]));
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5522
            }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5523
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5524
        case 11: 
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5525
            {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5526
                static struct inlineCache ilc11 = __DUMMYILCSELF11(@line+1);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5527
                RETURN ( _SEND11(self, aSelector, aClass, &ilc11, 
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5528
                                 argP[0], argP[1], argP[2], argP[3], argP[4], argP[5], 
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5529
                                 argP[6], argP[7], argP[8], argP[9], argP[10]));
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5530
            }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5531
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5532
        case 12: 
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5533
            {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5534
                static struct inlineCache ilc12 = __DUMMYILCSELF12(@line+1);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5535
                RETURN ( _SEND12(self, aSelector, aClass, &ilc12, 
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5536
                                 argP[0], argP[1], argP[2], argP[3], argP[4], argP[5], 
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5537
                                 argP[6], argP[7], argP[8], argP[9], argP[10], 
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5538
                                 argP[11]));
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5539
            }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5540
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5541
        case 13: 
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5542
            {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5543
                static struct inlineCache ilc13 = __DUMMYILCSELF13(@line+1);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5544
                RETURN ( _SEND13(self, aSelector, aClass, &ilc13, 
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5545
                                 argP[0], argP[1], argP[2], argP[3], argP[4], argP[5], 
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5546
                                 argP[6], argP[7], argP[8], argP[9], argP[10], 
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5547
                                 argP[11], argP[12]));
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5548
            }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5549
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5550
        case 14: 
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5551
            {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5552
                static struct inlineCache ilc14 = __DUMMYILCSELF14(@line+1);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5553
                RETURN ( _SEND14(self, aSelector, aClass, &ilc14, 
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5554
                                 argP[0], argP[1], argP[2], argP[3], argP[4], argP[5], 
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5555
                                 argP[6], argP[7], argP[8], argP[9], argP[10], 
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5556
                                 argP[11], argP[12], argP[13]));
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5557
            }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5558
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5559
        case 15: 
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5560
            {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5561
                static struct inlineCache ilc15 = __DUMMYILCSELF15(@line+1);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5562
                RETURN ( _SEND15(self, aSelector, aClass, &ilc15, 
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5563
                                 argP[0], argP[1], argP[2], argP[3], argP[4], argP[5], 
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5564
                                 argP[6], argP[7], argP[8], argP[9], argP[10], 
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5565
                                 argP[11], argP[12], argP[13], argP[14]));
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5566
            }
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5567
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5568
#ifdef _SEND16
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5569
        case 16:
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5570
            {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5571
                static struct inlineCache ilc16 = __DUMMYILCSELF16(@line+1);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5572
                RETURN ( _SEND16(self, aSelector, aClass, &ilc15,
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5573
                                 argP[0], argP[1], argP[2], argP[3], argP[4], argP[5],
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5574
                                 argP[6], argP[7], argP[8], argP[9], argP[10],
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5575
                                 argP[11], argP[12], argP[13], argP[14], argP[15]));
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5576
            }
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5577
#endif
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5578
#ifdef _SEND17
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5579
        case 17:
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5580
            {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5581
                static struct inlineCache ilc17 = __DUMMYILCSELF17(@line+1);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5582
                RETURN ( _SEND17(self, aSelector, aClass, &ilc15,
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5583
                                 argP[0], argP[1], argP[2], argP[3], argP[4], argP[5],
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5584
                                 argP[6], argP[7], argP[8], argP[9], argP[10],
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5585
                                 argP[11], argP[12], argP[13], argP[14], argP[15], argP[16]));
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5586
            }
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5587
#endif
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5588
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5589
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5590
    }
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5591
bad:;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5592
%}.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5593
    "/ arrive here, if bad number of arguments (too many)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5594
    "/ ST/X (currently) only allows up to 15 method arguments
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5595
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5596
    ^ self primitiveFailed
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5597
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5598
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5599
perform:aSelector with:arg
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5600
    "send the one-arg-message aSelector to the receiver"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5601
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5602
%{
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5603
    REGISTER OBJ sel = aSelector;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5604
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5605
    if (InterruptPending == nil) {
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5606
        struct inlineCache *pIlc;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5607
        static struct inlineCache ilc_0 = __ILCPERF1(@line);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5608
        static struct inlineCache ilc_1 = __ILCPERF1(@line);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5609
        static struct inlineCache ilc_2 = __ILCPERF1(@line);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5610
        static struct inlineCache ilc_3 = __ILCPERF1(@line);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5611
        static struct inlineCache ilc_4 = __ILCPERF1(@line);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5612
        static OBJ last_0 = nil;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5613
        static OBJ last_1 = nil;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5614
        static OBJ last_2 = nil;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5615
        static OBJ last_3 = nil;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5616
        static OBJ last_4 = nil;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5617
        static flip = 0;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5618
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5619
        if (sel == last_0) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5620
            pIlc = &ilc_0;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5621
        } else if (sel == last_1) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5622
            pIlc = &ilc_1;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5623
        } else if (sel == last_2) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5624
            pIlc = &ilc_2;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5625
        } else if (sel == last_3) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5626
            pIlc = &ilc_3;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5627
        } else if (sel == last_4) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5628
            pIlc = &ilc_4;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5629
        } else {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5630
            if (flip == 0) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5631
                pIlc = &ilc_0;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5632
                flip = 1;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5633
                last_0 = sel;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5634
            } else if (flip == 1) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5635
                pIlc = &ilc_1;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5636
                flip = 2;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5637
                last_1 = sel;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5638
            } else if (flip == 2) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5639
                pIlc = &ilc_2;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5640
                flip = 3;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5641
                last_2 = sel;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5642
            } else if (flip == 3) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5643
                pIlc = &ilc_3;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5644
                flip = 4;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5645
                last_3 = sel;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5646
            } else {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5647
                pIlc = &ilc_4;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5648
                flip = 0;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5649
                last_4 = sel;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5650
            }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5651
            pIlc->ilc_func = __SEND1ADDR__;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5652
            if (pIlc->ilc_poly) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5653
                __flushPolyCache(pIlc->ilc_poly);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5654
                pIlc->ilc_poly = 0;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5655
            }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5656
        }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5657
        RETURN ( (*(pIlc->ilc_func))(self, sel, nil, pIlc, arg) );
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5658
    } else {
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5659
        static struct inlineCache ilc1 = __DUMMYILCSELF1(@line+1);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5660
        RETURN (_SEND1(self, aSelector, nil, &ilc1, arg));
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5661
    }
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5662
%}.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5663
    ^ self perform:aSelector withArguments:(Array with:arg)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5664
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5665
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5666
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5667
perform:aSelector with:arg1 with:arg2
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5668
    "send the two-arg-message aSelector to the receiver"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5669
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5670
%{
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5671
    struct inlineCache *pIlc;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5672
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5673
    if (InterruptPending == nil) {
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5674
        static struct inlineCache ilc_0 = __ILCPERF2(@line);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5675
        static struct inlineCache ilc_1 = __ILCPERF2(@line);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5676
        static OBJ last_0 = nil;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5677
        static OBJ last_1 = nil;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5678
        static flip = 0;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5679
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5680
        if (aSelector == last_0) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5681
            pIlc = &ilc_0;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5682
        } else if (aSelector == last_1) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5683
            pIlc = &ilc_1;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5684
        } else {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5685
            if (flip == 0) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5686
                pIlc = &ilc_0;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5687
                flip = 1;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5688
                last_0 = aSelector;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5689
            } else {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5690
                pIlc = &ilc_1;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5691
                flip = 0;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5692
                last_1 = aSelector;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5693
            }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5694
            pIlc->ilc_func = __SEND2ADDR__;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5695
            if (pIlc->ilc_poly) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5696
                __flushPolyCache(pIlc->ilc_poly);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5697
                pIlc->ilc_poly = 0;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5698
            }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5699
        }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5700
        RETURN ( (*(pIlc->ilc_func))(self, aSelector, nil, pIlc, arg1, arg2) );
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5701
    } else {
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5702
        static struct inlineCache ilc2 = __DUMMYILCSELF2(@line+1);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5703
        RETURN (_SEND2(self, aSelector, nil, &ilc2, arg1, arg2));
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5704
    }
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5705
%}.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5706
    ^ self perform:aSelector withArguments:(Array with:arg1 with:arg2)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5707
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5708
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5709
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5710
perform:aSelector with:arg1 with:arg2 with:arg3
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5711
    "send the three-arg-message aSelector to the receiver"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5712
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5713
%{
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5714
    struct inlineCache *pIlc;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5715
    static struct inlineCache ilc_0 = __ILCPERF3(@line);
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5716
    static struct inlineCache ilc_1 = __ILCPERF3(@line);
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5717
    static OBJ last_0 = nil;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5718
    static OBJ last_1 = nil;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5719
    static flip = 0;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5720
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5721
    if (InterruptPending == nil) {
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5722
        if (aSelector != last_0) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5723
            if (aSelector != last_1) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5724
                if (flip) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5725
                    pIlc = &ilc_0;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5726
                    flip = 0;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5727
                    last_0 = aSelector;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5728
                } else {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5729
                    pIlc = &ilc_1;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5730
                    flip = 1;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5731
                    last_1 = aSelector;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5732
                }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5733
                pIlc->ilc_func = __SEND3ADDR__;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5734
                if (pIlc->ilc_poly) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5735
                    __flushPolyCache(pIlc->ilc_poly);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5736
                    pIlc->ilc_poly = 0;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5737
                }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5738
            } else {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5739
                pIlc = &ilc_1;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5740
            }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5741
        } else {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5742
            pIlc = &ilc_0;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5743
        }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5744
        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
  5745
    } else {
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5746
        static struct inlineCache ilc3 = __DUMMYILCSELF3(@line+1);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5747
        RETURN (_SEND3(self, aSelector, nil, &ilc3, arg1, arg2, arg3));
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5748
    }
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5749
%}.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5750
    ^ self perform:aSelector withArguments:(Array with:arg1 with:arg2 with:arg3)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5751
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5752
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5753
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5754
perform:aSelector with:arg1 with:arg2 with:arg3 with:arg4
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5755
    "send the four-arg-message aSelector to the receiver"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5756
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5757
%{
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5758
    struct inlineCache *pIlc;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5759
    static struct inlineCache ilc_0 = __ILCPERF4(@line);
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5760
    static struct inlineCache ilc_1 = __ILCPERF4(@line);
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5761
    static OBJ last_0 = nil;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5762
    static OBJ last_1 = nil;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5763
    static flip = 0;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5764
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5765
    if (InterruptPending == nil) {
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5766
        if (aSelector != last_0) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5767
            if (aSelector != last_1) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5768
                if (flip) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5769
                    pIlc = &ilc_0;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5770
                    flip = 0;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5771
                    last_0 = aSelector;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5772
                } else {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5773
                    pIlc = &ilc_1;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5774
                    flip = 1;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5775
                    last_1 = aSelector;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5776
                }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5777
                pIlc->ilc_func = __SEND4ADDR__;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5778
                if (pIlc->ilc_poly) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5779
                    __flushPolyCache(pIlc->ilc_poly);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5780
                    pIlc->ilc_poly = 0;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5781
                }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5782
            } else {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5783
                pIlc = &ilc_1;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5784
            }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5785
        } else {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5786
            pIlc = &ilc_0;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5787
        }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5788
        RETURN ( (*(pIlc->ilc_func))(self, aSelector, nil, pIlc, 
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5789
                                     arg1, arg2, arg3, arg4) );
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5790
    } else {
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5791
        static struct inlineCache ilc4 = __DUMMYILCSELF4(@line+1);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5792
        RETURN (_SEND4(self, aSelector, nil, &ilc4,
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5793
                       arg1, arg2, arg3, arg4));
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5794
    }
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5795
%}.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5796
    ^ 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
  5797
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5798
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5799
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5800
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
  5801
    "send the five-arg-message aSelector to the receiver"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5802
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5803
%{
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5804
    struct inlineCache *pIlc;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5805
    static struct inlineCache ilc_0 = __ILCPERF5(@line);
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5806
    static struct inlineCache ilc_1 = __ILCPERF5(@line);
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5807
    static OBJ last_0 = nil;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5808
    static OBJ last_1 = nil;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5809
    static flip = 0;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5810
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5811
    if (InterruptPending == nil) {
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5812
        if (aSelector != last_0) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5813
            if (aSelector != last_1) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5814
                if (flip) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5815
                    pIlc = &ilc_0;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5816
                    flip = 0;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5817
                    last_0 = aSelector;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5818
                } else {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5819
                    pIlc = &ilc_1;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5820
                    flip = 1;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5821
                    last_1 = aSelector;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5822
                }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5823
                pIlc->ilc_func = __SEND5ADDR__;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5824
                if (pIlc->ilc_poly) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5825
                    __flushPolyCache(pIlc->ilc_poly);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5826
                    pIlc->ilc_poly = 0;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5827
                }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5828
            } else {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5829
                pIlc = &ilc_1;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5830
            }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5831
        } else {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5832
            pIlc = &ilc_0;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5833
        }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5834
        RETURN ( (*(pIlc->ilc_func))(self, aSelector, nil, pIlc, 
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5835
                                     arg1, arg2, arg3, arg4, arg5) );
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5836
    } else {
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5837
        static struct inlineCache ilc5 = __DUMMYILCSELF5(@line+1);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5838
        RETURN (_SEND5(self, aSelector, nil, &ilc5,
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5839
                       arg1, arg2, arg3, arg4, arg5));
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
%}.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5842
    ^ self perform:aSelector withArguments:(Array with:arg1 with:arg2 with:arg3 with:arg4
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5843
                                                  with:arg5)
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5844
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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5847
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
  5848
    "send the six-arg-message aSelector to the receiver"
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
%{
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5851
    struct inlineCache *pIlc;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5852
    static struct inlineCache ilc_0 = __ILCPERF6(@line);
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5853
    static struct inlineCache ilc_1 = __ILCPERF6(@line);
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5854
    static OBJ last_0 = nil;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5855
    static OBJ last_1 = nil;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5856
    static flip = 0;
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
    if (InterruptPending == nil) {
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5859
        if (aSelector != last_0) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5860
            if (aSelector != last_1) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5861
                if (flip) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5862
                    pIlc = &ilc_0;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5863
                    flip = 0;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5864
                    last_0 = aSelector;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5865
                } else {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5866
                    pIlc = &ilc_1;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5867
                    flip = 1;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5868
                    last_1 = aSelector;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5869
                }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5870
                pIlc->ilc_func = __SEND6ADDR__;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5871
                if (pIlc->ilc_poly) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5872
                    __flushPolyCache(pIlc->ilc_poly);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5873
                    pIlc->ilc_poly = 0;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5874
                }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5875
            } else {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5876
                pIlc = &ilc_1;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5877
            }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5878
        } else {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5879
            pIlc = &ilc_0;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5880
        }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5881
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5882
        RETURN ( (*(pIlc->ilc_func))(self, aSelector, nil, pIlc, 
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5883
                                     arg1, arg2, arg3, arg4, arg5, arg6) );
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5884
    } else {
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5885
        static struct inlineCache ilc6 = __DUMMYILCSELF6(@line+1);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5886
        RETURN (_SEND6(self, aSelector, nil, &ilc6,
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5887
                       arg1, arg2, arg3, arg4, arg5, arg6));
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5888
    }
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5889
%}.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5890
    ^ self perform:aSelector withArguments:(Array with:arg1 with:arg2 with:arg3 with:arg4
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5891
                                                  with:arg5 with:arg6)
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5892
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
perform:aSelector withArguments:argArray
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5896
    "send the message aSelector with all args taken from argArray 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5897
     to the receiver."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5898
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5899
    |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
  5900
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5901
%{
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5902
    REGISTER OBJ *argP;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5903
    int nargs;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5904
    OBJ l;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5905
8934
32a063645991 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8930
diff changeset
  5906
    if (__isArrayLike(argArray)) {
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5907
        nargs = __arraySize(argArray);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5908
        argP = __arrayVal(argArray);
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5909
    } else {
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5910
        if (__isNonNilObject(argArray)) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5911
            static struct inlineCache ilcSize = __ILC0(@line);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5912
            int i;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5913
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5914
            numberOfArgs = (*ilcSize.ilc_func)(argArray, @symbol(size), nil, &ilcSize); 
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5915
            if (!__isSmallInteger(numberOfArgs)) 
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5916
                goto bad;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5917
            nargs = __intVal(numberOfArgs);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5918
            argP = (OBJ *)(&a1);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5919
            for (i=1; i <= nargs; i++) {
8913
b9498d27a554 64bit; mkSmallInteger
Claus Gittinger <cg@exept.de>
parents: 8909
diff changeset
  5920
                *argP++ = __AT_(argArray, __mkSmallInteger(i));
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5921
            }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5922
            argP = (OBJ *)(&a1);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5923
        } else {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5924
            nargs = 0;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5925
        }
5755
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
    switch (nargs) {
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5928
        case 0:
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5929
            if (InterruptPending == nil) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5930
                static OBJ last0_0 = nil; static struct inlineCache ilc0_0 = __ILCPERF0(@line);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5931
                static OBJ last0_1 = nil; static struct inlineCache ilc0_1 = __ILCPERF0(@line);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5932
                static OBJ last0_2 = nil; static struct inlineCache ilc0_2 = __ILCPERF0(@line);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5933
                static OBJ last0_3 = nil; static struct inlineCache ilc0_3 = __ILCPERF0(@line);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5934
                static int flip0 = 0;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5935
                struct inlineCache *pIlc;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5936
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5937
                if (aSelector == last0_0) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5938
                    pIlc = &ilc0_0;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5939
                } else if (aSelector == last0_1) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5940
                    pIlc = &ilc0_1;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5941
                } else if (aSelector == last0_2) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5942
                    pIlc = &ilc0_2;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5943
                } else if (aSelector == last0_3) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5944
                    pIlc = &ilc0_3;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5945
                } else {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5946
                    if (flip0 == 0) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5947
                        pIlc = &ilc0_0;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5948
                        flip0 = 1;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5949
                        last0_0 = aSelector;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5950
                    } else if (flip0 == 1) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5951
                        pIlc = &ilc0_1;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5952
                        flip0 = 2;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5953
                        last0_1 = aSelector;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5954
                    } else if (flip0 == 2) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5955
                        pIlc = &ilc0_2;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5956
                        flip0 = 3;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5957
                        last0_2 = aSelector;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5958
                    } else {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5959
                        pIlc = &ilc0_3;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5960
                        flip0 = 0;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5961
                        last0_3 = aSelector;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5962
                    }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5963
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5964
                    pIlc->ilc_func = __SEND0ADDR__;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5965
                    if (pIlc->ilc_poly) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5966
                        __flushPolyCache(pIlc->ilc_poly);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5967
                        pIlc->ilc_poly = 0;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5968
                    }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5969
                }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5970
                RETURN ((*pIlc->ilc_func)(self, aSelector, nil, pIlc));
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5971
            } else {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5972
                static struct inlineCache ilc0 = __DUMMYILCSELF0(@line+1);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5973
                RETURN (_SEND0(self, aSelector, nil, &ilc0));
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5974
            }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5975
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5976
        case 1: 
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5977
            if (InterruptPending == nil) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5978
                static OBJ last1_0 = nil; static struct inlineCache ilc1_0 = __ILCPERF1(@line);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5979
                static OBJ last1_1 = nil; static struct inlineCache ilc1_1 = __ILCPERF1(@line);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5980
                static OBJ last1_2 = nil; static struct inlineCache ilc1_2 = __ILCPERF1(@line);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5981
                static OBJ last1_3 = nil; static struct inlineCache ilc1_3 = __ILCPERF1(@line);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5982
                static int flip1 = 0;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5983
                struct inlineCache *pIlc;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5984
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5985
                if (aSelector == last1_0) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5986
                    pIlc = &ilc1_0;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5987
                } else if (aSelector == last1_1) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5988
                    pIlc = &ilc1_1;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5989
                } else if (aSelector == last1_2) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5990
                    pIlc = &ilc1_2;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5991
                } else if (aSelector == last1_3) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5992
                    pIlc = &ilc1_3;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5993
                } else {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5994
                    if (flip1 == 0) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5995
                        pIlc = &ilc1_0;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5996
                        flip1 = 1;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5997
                        last1_0 = aSelector;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5998
                    } else if (flip1 == 1) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  5999
                        pIlc = &ilc1_1;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6000
                        flip1 = 2;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6001
                        last1_1 = aSelector;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6002
                    } else if (flip1 == 2) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6003
                        pIlc = &ilc1_2;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6004
                        flip1 = 3;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6005
                        last1_2 = aSelector;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6006
                    } else {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6007
                        pIlc = &ilc1_3;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6008
                        flip1 = 0;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6009
                        last1_3 = aSelector;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6010
                    }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6011
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6012
                    pIlc->ilc_func = __SEND1ADDR__;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6013
                    if (pIlc->ilc_poly) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6014
                        __flushPolyCache(pIlc->ilc_poly);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6015
                        pIlc->ilc_poly = 0;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6016
                    }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6017
                }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6018
                RETURN ((*pIlc->ilc_func)(self, aSelector, nil, pIlc, argP[0]));
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6019
            } else {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6020
                static struct inlineCache ilc1 = __DUMMYILCSELF1(@line+1);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6021
                RETURN (_SEND1(self, aSelector, nil, &ilc1, argP[0]));
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6022
            }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6023
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6024
        case 2: 
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6025
            if (InterruptPending == nil) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6026
                static OBJ last2_0 = nil; static struct inlineCache ilc2_0 = __ILCPERF2(@line);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6027
                static OBJ last2_1 = nil; static struct inlineCache ilc2_1 = __ILCPERF2(@line);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6028
                static int flip2 = 0;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6029
                struct inlineCache *pIlc;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6030
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6031
                if (aSelector == last2_0) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6032
                    pIlc = &ilc2_0;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6033
                } else if (aSelector == last2_1) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6034
                    pIlc = &ilc2_1;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6035
                } else {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6036
                    if (flip2 == 0) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6037
                        pIlc = &ilc2_0;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6038
                        flip2 = 1;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6039
                        last2_0 = aSelector;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6040
                    } else {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6041
                        pIlc = &ilc2_1;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6042
                        flip2 = 0;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6043
                        last2_1 = aSelector;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6044
                    }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6045
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6046
                    pIlc->ilc_func = __SEND2ADDR__;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6047
                    if (pIlc->ilc_poly) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6048
                        __flushPolyCache(pIlc->ilc_poly);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6049
                        pIlc->ilc_poly = 0;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6050
                    }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6051
                }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6052
                RETURN ((*pIlc->ilc_func)(self, aSelector, nil, pIlc, argP[0], argP[1]));
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6053
            } else {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6054
                static struct inlineCache ilc2 = __DUMMYILCSELF2(@line+1);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6055
                RETURN (_SEND2(self, aSelector, nil, &ilc2, argP[0], argP[1]));
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6056
            }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6057
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6058
        case 3: 
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6059
            if (InterruptPending == nil) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6060
                static OBJ last3_0 = nil; static struct inlineCache ilc3_0 = __ILCPERF3(@line);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6061
                static OBJ last3_1 = nil; static struct inlineCache ilc3_1 = __ILCPERF3(@line);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6062
                static int flip3 = 0;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6063
                struct inlineCache *pIlc;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6064
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6065
                if (aSelector == last3_0) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6066
                    pIlc = &ilc3_0;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6067
                } else if (aSelector == last3_1) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6068
                    pIlc = &ilc3_1;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6069
                } else {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6070
                    if (flip3 == 0) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6071
                        pIlc = &ilc3_0;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6072
                        flip3 = 1;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6073
                        last3_0 = aSelector;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6074
                    } else {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6075
                        pIlc = &ilc3_1;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6076
                        flip3 = 0;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6077
                        last3_1 = aSelector;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6078
                    }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6079
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6080
                    pIlc->ilc_func = __SEND3ADDR__;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6081
                    if (pIlc->ilc_poly) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6082
                        __flushPolyCache(pIlc->ilc_poly);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6083
                        pIlc->ilc_poly = 0;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6084
                    }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6085
                }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6086
                RETURN ((*pIlc->ilc_func)(self, aSelector, nil, pIlc, argP[0], argP[1], argP[2]));
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6087
            } else {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6088
                static struct inlineCache ilc3 = __DUMMYILCSELF3(@line+1);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6089
                RETURN (_SEND3(self, aSelector, nil, &ilc3, argP[0], argP[1], argP[2]));
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6090
            }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6091
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6092
        case 4: 
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6093
            {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6094
                static OBJ last4 = nil; static struct inlineCache ilc4 = __ILCPERF4(@line);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6095
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6096
                if ((InterruptPending != nil) || (aSelector != last4)) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6097
                    ilc4.ilc_func = __SEND4ADDR__;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6098
                    if (ilc4.ilc_poly) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6099
                        __flushPolyCache(ilc4.ilc_poly);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6100
                        ilc4.ilc_poly = 0;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6101
                    }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6102
                    last4 = aSelector;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6103
                }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6104
                RETURN ( (*ilc4.ilc_func)(self, aSelector, nil, &ilc4,
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6105
                                                argP[0], argP[1], argP[2], argP[3]));
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6106
            }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6107
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6108
        case 5: 
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6109
            {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6110
                static OBJ last5 = nil; static struct inlineCache ilc5 = __ILCPERF5(@line);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6111
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6112
                if ((InterruptPending != nil) || (aSelector != last5)) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6113
                    ilc5.ilc_func = __SEND5ADDR__;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6114
                    if (ilc5.ilc_poly) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6115
                        __flushPolyCache(ilc5.ilc_poly);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6116
                        ilc5.ilc_poly = 0;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6117
                    }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6118
                    last5 = aSelector;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6119
                }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6120
                RETURN ( (*ilc5.ilc_func)(self, aSelector, nil, &ilc5, 
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6121
                                                argP[0], argP[1], argP[2], argP[3], argP[4]));
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6122
            }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6123
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6124
        case 6: 
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6125
            {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6126
                static OBJ last6 = nil; static struct inlineCache ilc6 = __ILCPERF6(@line);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6127
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6128
                if ((InterruptPending != nil) || (aSelector != last6)) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6129
                    ilc6.ilc_func = __SEND6ADDR__;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6130
                    if (ilc6.ilc_poly) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6131
                        __flushPolyCache(ilc6.ilc_poly);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6132
                        ilc6.ilc_poly = 0;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6133
                    }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6134
                    last6 = aSelector;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6135
                }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6136
                RETURN ( (*ilc6.ilc_func)(self, aSelector, nil, &ilc6, 
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6137
                                                argP[0], argP[1], argP[2], argP[3], argP[4],
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6138
                                                argP[5]));
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6139
            }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6140
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6141
        case 7: 
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6142
            {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6143
                static OBJ last7 = nil; static struct inlineCache ilc7 = __ILCPERF7(@line);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6144
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6145
                if ((InterruptPending != nil) || (aSelector != last7)) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6146
                    ilc7.ilc_func = __SEND7ADDR__;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6147
                    if (ilc7.ilc_poly) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6148
                        __flushPolyCache(ilc7.ilc_poly);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6149
                        ilc7.ilc_poly = 0;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6150
                    }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6151
                    last7 = aSelector;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6152
                }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6153
                RETURN ( (*ilc7.ilc_func)(self, aSelector, nil, &ilc7, 
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6154
                                                argP[0], argP[1], argP[2], argP[3], argP[4],
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6155
                                                argP[5], argP[6]));
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6156
            }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6157
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6158
        case 8:
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6159
            {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6160
                static OBJ last8 = nil; static struct inlineCache ilc8 = __ILCPERF8(@line);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6161
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6162
                if ((InterruptPending != nil) || (aSelector != last8)) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6163
                    ilc8.ilc_func = __SEND8ADDR__;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6164
                    if (ilc8.ilc_poly) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6165
                        __flushPolyCache(ilc8.ilc_poly);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6166
                        ilc8.ilc_poly = 0;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6167
                    }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6168
                    last8 = aSelector;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6169
                }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6170
                RETURN ( (*ilc8.ilc_func)(self, aSelector, nil, &ilc8, 
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6171
                                                argP[0], argP[1], argP[2], argP[3], argP[4],
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6172
                                                argP[5], argP[6], argP[7]));
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6173
            }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6174
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6175
        case 9: 
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6176
            {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6177
                static OBJ last9 = nil; static struct inlineCache ilc9 = __ILCPERF9(@line);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6178
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6179
                if ((InterruptPending != nil) || (aSelector != last9)) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6180
                    ilc9.ilc_func = __SEND9ADDR__;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6181
                    if (ilc9.ilc_poly) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6182
                        __flushPolyCache(ilc9.ilc_poly);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6183
                        ilc9.ilc_poly = 0;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6184
                    }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6185
                    last9 = aSelector;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6186
                }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6187
                RETURN ( (*ilc9.ilc_func)(self, aSelector, nil, &ilc9, 
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6188
                                                argP[0], argP[1], argP[2], argP[3], argP[4],
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6189
                                                argP[5], argP[6], argP[7], argP[8]));
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6190
            }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6191
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6192
        case 10: 
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6193
            {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6194
                static OBJ last10 = nil; static struct inlineCache ilc10 = __ILCPERF10(@line);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6195
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6196
                if ((InterruptPending != nil) || (aSelector != last10)) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6197
                    ilc10.ilc_func = __SEND10ADDR__;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6198
                    if (ilc10.ilc_poly) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6199
                        __flushPolyCache(ilc10.ilc_poly);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6200
                        ilc10.ilc_poly = 0;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6201
                    }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6202
                    last10 = aSelector;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6203
                }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6204
                RETURN ( (*ilc10.ilc_func)(self, aSelector, nil, &ilc10, 
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6205
                                                argP[0], argP[1], argP[2], argP[3], argP[4],
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6206
                                                argP[5], argP[6], argP[7], argP[8], argP[9]));
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6207
            }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6208
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6209
        case 11: 
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6210
            {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6211
                static OBJ last11 = nil; static struct inlineCache ilc11 = __ILCPERF11(@line);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6212
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6213
                if ((InterruptPending != nil) || (aSelector != last11)) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6214
                    ilc11.ilc_func = __SEND11ADDR__;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6215
                    if (ilc11.ilc_poly) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6216
                        __flushPolyCache(ilc11.ilc_poly);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6217
                        ilc11.ilc_poly = 0;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6218
                    }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6219
                    last11 = aSelector;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6220
                }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6221
                RETURN ( (*ilc11.ilc_func)(self, aSelector, nil, &ilc11, 
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6222
                                                argP[0], argP[1], argP[2], argP[3], argP[4],
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6223
                                                argP[5], argP[6], argP[7], argP[8], argP[9],
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6224
                                                argP[10]));
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6225
            }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6226
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6227
        case 12: 
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6228
            {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6229
                static OBJ last12 = nil; static struct inlineCache ilc12 = __ILCPERF12(@line);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6230
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6231
                if ((InterruptPending != nil) || (aSelector != last12)) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6232
                    ilc12.ilc_func = __SEND12ADDR__;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6233
                    if (ilc12.ilc_poly) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6234
                        __flushPolyCache(ilc12.ilc_poly);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6235
                        ilc12.ilc_poly = 0;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6236
                    }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6237
                    last12 = aSelector;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6238
                }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6239
                RETURN ( (*ilc12.ilc_func)(self, aSelector, nil, &ilc12, 
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6240
                                                argP[0], argP[1], argP[2], argP[3], argP[4],
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6241
                                                argP[5], argP[6], argP[7], argP[8], argP[9],
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6242
                                                argP[10], argP[11]));
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6243
            }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6244
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6245
        case 13: 
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6246
            {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6247
                static OBJ last13 = nil; static struct inlineCache ilc13 = __ILCPERF13(@line);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6248
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6249
                if ((InterruptPending != nil) || (aSelector != last13)) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6250
                    ilc13.ilc_func = __SEND13ADDR__;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6251
                    if (ilc13.ilc_poly) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6252
                        __flushPolyCache(ilc13.ilc_poly);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6253
                        ilc13.ilc_poly = 0;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6254
                    }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6255
                    last13 = aSelector;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6256
                }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6257
                RETURN ( (*ilc13.ilc_func)(self, aSelector, nil, &ilc13, 
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6258
                                                argP[0], argP[1], argP[2], argP[3], argP[4],
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6259
                                                argP[5], argP[6], argP[7], argP[8], argP[9],
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6260
                                                argP[10], argP[11], argP[12]));
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6261
            }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6262
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6263
        case 14: 
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6264
            {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6265
                static OBJ last14 = nil; static struct inlineCache ilc14 = __ILCPERF14(@line);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6266
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6267
                if ((InterruptPending != nil) || (aSelector != last14)) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6268
                    ilc14.ilc_func = __SEND14ADDR__;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6269
                    if (ilc14.ilc_poly) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6270
                        __flushPolyCache(ilc14.ilc_poly);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6271
                        ilc14.ilc_poly = 0;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6272
                    }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6273
                    last14 = aSelector;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6274
                }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6275
                RETURN ( (*ilc14.ilc_func)(self, aSelector, nil, &ilc14, 
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6276
                                                argP[0], argP[1], argP[2], argP[3], argP[4],
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6277
                                                argP[5], argP[6], argP[7], argP[8], argP[9],
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6278
                                                argP[10], argP[11], argP[12], argP[13]));
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6279
            }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6280
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6281
        case 15: 
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6282
            {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6283
                static OBJ last15 = nil; static struct inlineCache ilc15 = __ILCPERF15(@line);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6284
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6285
                if ((InterruptPending != nil) || (aSelector != last15)) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6286
                    ilc15.ilc_func = __SEND15ADDR__;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6287
                    if (ilc15.ilc_poly) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6288
                        __flushPolyCache(ilc15.ilc_poly);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6289
                        ilc15.ilc_poly = 0;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6290
                    }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6291
                    last15 = aSelector;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6292
                }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6293
                RETURN ( (*ilc15.ilc_func)(self, aSelector, nil, &ilc15, 
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6294
                                                argP[0], argP[1], argP[2], argP[3], argP[4],
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6295
                                                argP[5], argP[6], argP[7], argP[8], argP[9],
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6296
                                                argP[10], argP[11], argP[12], argP[13],
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6297
                                                argP[14]));
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6298
            }
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6299
    }
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6300
bad:;
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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6303
    "/ arrive here, if bad number of arguments (too many)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6304
    "/ ST/X (currently) only allows up to 15 method arguments
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6305
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6306
    ^ self primitiveFailed
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6307
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6308
6316
345f36d2fc65 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6263
diff changeset
  6309
perform:aSelector withOptionalArgument:arg
345f36d2fc65 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6263
diff changeset
  6310
    "send aSelector-message to the receiver.
6318
3677d346113a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  6311
     If the message expects an argument, pass arg."
6316
345f36d2fc65 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6263
diff changeset
  6312
345f36d2fc65 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6263
diff changeset
  6313
    aSelector numArgs == 1 ifTrue:[
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6314
        ^ self perform:aSelector with:arg
6316
345f36d2fc65 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6263
diff changeset
  6315
    ].
345f36d2fc65 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6263
diff changeset
  6316
    ^ self perform:aSelector
6319
75252ef51b38 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6318
diff changeset
  6317
75252ef51b38 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6318
diff changeset
  6318
    "
75252ef51b38 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6318
diff changeset
  6319
     |rec sel|
75252ef51b38 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6318
diff changeset
  6320
75252ef51b38 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6318
diff changeset
  6321
     rec := -1.
75252ef51b38 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6318
diff changeset
  6322
     sel := #abs.
75252ef51b38 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6318
diff changeset
  6323
     rec perform:sel withOptionalArgument:2.
75252ef51b38 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6318
diff changeset
  6324
75252ef51b38 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6318
diff changeset
  6325
     sel := #max:.
75252ef51b38 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6318
diff changeset
  6326
     rec perform:sel withOptionalArgument:2.
75252ef51b38 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6318
diff changeset
  6327
    "
6316
345f36d2fc65 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6263
diff changeset
  6328
!
345f36d2fc65 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6263
diff changeset
  6329
6321
8af99331b6e8 #perform:withOptionalArgument:and:
Claus Gittinger <cg@exept.de>
parents: 6319
diff changeset
  6330
perform:aSelector withOptionalArgument:optionalArg1 and:optionalArg2
8af99331b6e8 #perform:withOptionalArgument:and:
Claus Gittinger <cg@exept.de>
parents: 6319
diff changeset
  6331
    "send aSelector-message to the receiver.
6728
a4fc441779dc with 3 OptionalArguments
Claus Gittinger <cg@exept.de>
parents: 6721
diff changeset
  6332
     Depending on the number of arguments the message expects,
a4fc441779dc with 3 OptionalArguments
Claus Gittinger <cg@exept.de>
parents: 6721
diff changeset
  6333
     pass either none, 1, or 2 arguments."
6321
8af99331b6e8 #perform:withOptionalArgument:and:
Claus Gittinger <cg@exept.de>
parents: 6319
diff changeset
  6334
8af99331b6e8 #perform:withOptionalArgument:and:
Claus Gittinger <cg@exept.de>
parents: 6319
diff changeset
  6335
    |numArgs|
8af99331b6e8 #perform:withOptionalArgument:and:
Claus Gittinger <cg@exept.de>
parents: 6319
diff changeset
  6336
8af99331b6e8 #perform:withOptionalArgument:and:
Claus Gittinger <cg@exept.de>
parents: 6319
diff changeset
  6337
    numArgs := aSelector numArgs.
8af99331b6e8 #perform:withOptionalArgument:and:
Claus Gittinger <cg@exept.de>
parents: 6319
diff changeset
  6338
    numArgs == 0 ifTrue:[
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6339
        ^ self perform:aSelector
6321
8af99331b6e8 #perform:withOptionalArgument:and:
Claus Gittinger <cg@exept.de>
parents: 6319
diff changeset
  6340
    ].
8af99331b6e8 #perform:withOptionalArgument:and:
Claus Gittinger <cg@exept.de>
parents: 6319
diff changeset
  6341
    numArgs == 1 ifTrue:[
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6342
        ^ self perform:aSelector with:optionalArg1
6321
8af99331b6e8 #perform:withOptionalArgument:and:
Claus Gittinger <cg@exept.de>
parents: 6319
diff changeset
  6343
    ].
8af99331b6e8 #perform:withOptionalArgument:and:
Claus Gittinger <cg@exept.de>
parents: 6319
diff changeset
  6344
    ^ self perform:aSelector with:optionalArg1 with:optionalArg2.
8af99331b6e8 #perform:withOptionalArgument:and:
Claus Gittinger <cg@exept.de>
parents: 6319
diff changeset
  6345
8af99331b6e8 #perform:withOptionalArgument:and:
Claus Gittinger <cg@exept.de>
parents: 6319
diff changeset
  6346
    "
8af99331b6e8 #perform:withOptionalArgument:and:
Claus Gittinger <cg@exept.de>
parents: 6319
diff changeset
  6347
     |rec sel|
8af99331b6e8 #perform:withOptionalArgument:and:
Claus Gittinger <cg@exept.de>
parents: 6319
diff changeset
  6348
8af99331b6e8 #perform:withOptionalArgument:and:
Claus Gittinger <cg@exept.de>
parents: 6319
diff changeset
  6349
     rec := -1.
8af99331b6e8 #perform:withOptionalArgument:and:
Claus Gittinger <cg@exept.de>
parents: 6319
diff changeset
  6350
     sel := #abs.
8af99331b6e8 #perform:withOptionalArgument:and:
Claus Gittinger <cg@exept.de>
parents: 6319
diff changeset
  6351
     rec perform:sel withOptionalArgument:2.
8af99331b6e8 #perform:withOptionalArgument:and:
Claus Gittinger <cg@exept.de>
parents: 6319
diff changeset
  6352
8af99331b6e8 #perform:withOptionalArgument:and:
Claus Gittinger <cg@exept.de>
parents: 6319
diff changeset
  6353
     sel := #max:.
8af99331b6e8 #perform:withOptionalArgument:and:
Claus Gittinger <cg@exept.de>
parents: 6319
diff changeset
  6354
     rec perform:sel withOptionalArgument:2.
8af99331b6e8 #perform:withOptionalArgument:and:
Claus Gittinger <cg@exept.de>
parents: 6319
diff changeset
  6355
    "
8af99331b6e8 #perform:withOptionalArgument:and:
Claus Gittinger <cg@exept.de>
parents: 6319
diff changeset
  6356
!
8af99331b6e8 #perform:withOptionalArgument:and:
Claus Gittinger <cg@exept.de>
parents: 6319
diff changeset
  6357
6728
a4fc441779dc with 3 OptionalArguments
Claus Gittinger <cg@exept.de>
parents: 6721
diff changeset
  6358
perform:aSelector withOptionalArgument:optionalArg1 and:optionalArg2 and:optionalArg3
a4fc441779dc with 3 OptionalArguments
Claus Gittinger <cg@exept.de>
parents: 6721
diff changeset
  6359
    "send aSelector-message to the receiver.
a4fc441779dc with 3 OptionalArguments
Claus Gittinger <cg@exept.de>
parents: 6721
diff changeset
  6360
     Depending on the number of arguments the message expects,
a4fc441779dc with 3 OptionalArguments
Claus Gittinger <cg@exept.de>
parents: 6721
diff changeset
  6361
     pass either none, 1, 2 or 3 arguments."
a4fc441779dc with 3 OptionalArguments
Claus Gittinger <cg@exept.de>
parents: 6721
diff changeset
  6362
a4fc441779dc with 3 OptionalArguments
Claus Gittinger <cg@exept.de>
parents: 6721
diff changeset
  6363
    |numArgs|
a4fc441779dc with 3 OptionalArguments
Claus Gittinger <cg@exept.de>
parents: 6721
diff changeset
  6364
a4fc441779dc with 3 OptionalArguments
Claus Gittinger <cg@exept.de>
parents: 6721
diff changeset
  6365
    numArgs := aSelector numArgs.
a4fc441779dc with 3 OptionalArguments
Claus Gittinger <cg@exept.de>
parents: 6721
diff changeset
  6366
    numArgs == 0 ifTrue:[
a4fc441779dc with 3 OptionalArguments
Claus Gittinger <cg@exept.de>
parents: 6721
diff changeset
  6367
        ^ self perform:aSelector
a4fc441779dc with 3 OptionalArguments
Claus Gittinger <cg@exept.de>
parents: 6721
diff changeset
  6368
    ].
a4fc441779dc with 3 OptionalArguments
Claus Gittinger <cg@exept.de>
parents: 6721
diff changeset
  6369
    numArgs == 1 ifTrue:[
a4fc441779dc with 3 OptionalArguments
Claus Gittinger <cg@exept.de>
parents: 6721
diff changeset
  6370
        ^ self perform:aSelector with:optionalArg1
a4fc441779dc with 3 OptionalArguments
Claus Gittinger <cg@exept.de>
parents: 6721
diff changeset
  6371
    ].
a4fc441779dc with 3 OptionalArguments
Claus Gittinger <cg@exept.de>
parents: 6721
diff changeset
  6372
    numArgs == 2 ifTrue:[
a4fc441779dc with 3 OptionalArguments
Claus Gittinger <cg@exept.de>
parents: 6721
diff changeset
  6373
        ^ self perform:aSelector with:optionalArg1 with:optionalArg2
a4fc441779dc with 3 OptionalArguments
Claus Gittinger <cg@exept.de>
parents: 6721
diff changeset
  6374
    ].
a4fc441779dc with 3 OptionalArguments
Claus Gittinger <cg@exept.de>
parents: 6721
diff changeset
  6375
    ^ self perform:aSelector with:optionalArg1 with:optionalArg2 with:optionalArg3.
a4fc441779dc with 3 OptionalArguments
Claus Gittinger <cg@exept.de>
parents: 6721
diff changeset
  6376
a4fc441779dc with 3 OptionalArguments
Claus Gittinger <cg@exept.de>
parents: 6721
diff changeset
  6377
    "
a4fc441779dc with 3 OptionalArguments
Claus Gittinger <cg@exept.de>
parents: 6721
diff changeset
  6378
     |rec sel|
a4fc441779dc with 3 OptionalArguments
Claus Gittinger <cg@exept.de>
parents: 6721
diff changeset
  6379
a4fc441779dc with 3 OptionalArguments
Claus Gittinger <cg@exept.de>
parents: 6721
diff changeset
  6380
     rec := -1.
a4fc441779dc with 3 OptionalArguments
Claus Gittinger <cg@exept.de>
parents: 6721
diff changeset
  6381
     sel := #abs.
a4fc441779dc with 3 OptionalArguments
Claus Gittinger <cg@exept.de>
parents: 6721
diff changeset
  6382
     rec perform:sel withOptionalArgument:2.
a4fc441779dc with 3 OptionalArguments
Claus Gittinger <cg@exept.de>
parents: 6721
diff changeset
  6383
a4fc441779dc with 3 OptionalArguments
Claus Gittinger <cg@exept.de>
parents: 6721
diff changeset
  6384
     sel := #max:.
a4fc441779dc with 3 OptionalArguments
Claus Gittinger <cg@exept.de>
parents: 6721
diff changeset
  6385
     rec perform:sel withOptionalArgument:2.
a4fc441779dc with 3 OptionalArguments
Claus Gittinger <cg@exept.de>
parents: 6721
diff changeset
  6386
    "
a4fc441779dc with 3 OptionalArguments
Claus Gittinger <cg@exept.de>
parents: 6721
diff changeset
  6387
!
a4fc441779dc with 3 OptionalArguments
Claus Gittinger <cg@exept.de>
parents: 6721
diff changeset
  6388
6764
c5455cf45678 perform:withOptional*
Claus Gittinger <cg@exept.de>
parents: 6741
diff changeset
  6389
perform:aSelector withOptionalArgument:optionalArg1 and:optionalArg2 and:optionalArg3 and:optionalArg4
c5455cf45678 perform:withOptional*
Claus Gittinger <cg@exept.de>
parents: 6741
diff changeset
  6390
    "send aSelector-message to the receiver.
c5455cf45678 perform:withOptional*
Claus Gittinger <cg@exept.de>
parents: 6741
diff changeset
  6391
     Depending on the number of arguments the message expects,
c5455cf45678 perform:withOptional*
Claus Gittinger <cg@exept.de>
parents: 6741
diff changeset
  6392
     pass either none, 1, 2, 3 or 4 arguments."
c5455cf45678 perform:withOptional*
Claus Gittinger <cg@exept.de>
parents: 6741
diff changeset
  6393
c5455cf45678 perform:withOptional*
Claus Gittinger <cg@exept.de>
parents: 6741
diff changeset
  6394
    |numArgs|
c5455cf45678 perform:withOptional*
Claus Gittinger <cg@exept.de>
parents: 6741
diff changeset
  6395
c5455cf45678 perform:withOptional*
Claus Gittinger <cg@exept.de>
parents: 6741
diff changeset
  6396
    numArgs := aSelector numArgs.
c5455cf45678 perform:withOptional*
Claus Gittinger <cg@exept.de>
parents: 6741
diff changeset
  6397
    numArgs == 0 ifTrue:[
c5455cf45678 perform:withOptional*
Claus Gittinger <cg@exept.de>
parents: 6741
diff changeset
  6398
        ^ self perform:aSelector
c5455cf45678 perform:withOptional*
Claus Gittinger <cg@exept.de>
parents: 6741
diff changeset
  6399
    ].
c5455cf45678 perform:withOptional*
Claus Gittinger <cg@exept.de>
parents: 6741
diff changeset
  6400
    numArgs == 1 ifTrue:[
c5455cf45678 perform:withOptional*
Claus Gittinger <cg@exept.de>
parents: 6741
diff changeset
  6401
        ^ self perform:aSelector with:optionalArg1
c5455cf45678 perform:withOptional*
Claus Gittinger <cg@exept.de>
parents: 6741
diff changeset
  6402
    ].
c5455cf45678 perform:withOptional*
Claus Gittinger <cg@exept.de>
parents: 6741
diff changeset
  6403
    numArgs == 2 ifTrue:[
c5455cf45678 perform:withOptional*
Claus Gittinger <cg@exept.de>
parents: 6741
diff changeset
  6404
        ^ self perform:aSelector with:optionalArg1 with:optionalArg2
c5455cf45678 perform:withOptional*
Claus Gittinger <cg@exept.de>
parents: 6741
diff changeset
  6405
    ].
c5455cf45678 perform:withOptional*
Claus Gittinger <cg@exept.de>
parents: 6741
diff changeset
  6406
    numArgs == 3 ifTrue:[
c5455cf45678 perform:withOptional*
Claus Gittinger <cg@exept.de>
parents: 6741
diff changeset
  6407
        ^ self perform:aSelector with:optionalArg1 with:optionalArg2 with:optionalArg3
c5455cf45678 perform:withOptional*
Claus Gittinger <cg@exept.de>
parents: 6741
diff changeset
  6408
    ].
c5455cf45678 perform:withOptional*
Claus Gittinger <cg@exept.de>
parents: 6741
diff changeset
  6409
    ^ self perform:aSelector with:optionalArg1 with:optionalArg2 with:optionalArg3 with:optionalArg4.
c5455cf45678 perform:withOptional*
Claus Gittinger <cg@exept.de>
parents: 6741
diff changeset
  6410
c5455cf45678 perform:withOptional*
Claus Gittinger <cg@exept.de>
parents: 6741
diff changeset
  6411
    "
c5455cf45678 perform:withOptional*
Claus Gittinger <cg@exept.de>
parents: 6741
diff changeset
  6412
     |rec sel|
c5455cf45678 perform:withOptional*
Claus Gittinger <cg@exept.de>
parents: 6741
diff changeset
  6413
c5455cf45678 perform:withOptional*
Claus Gittinger <cg@exept.de>
parents: 6741
diff changeset
  6414
     rec := -1.
c5455cf45678 perform:withOptional*
Claus Gittinger <cg@exept.de>
parents: 6741
diff changeset
  6415
     sel := #abs.
c5455cf45678 perform:withOptional*
Claus Gittinger <cg@exept.de>
parents: 6741
diff changeset
  6416
     rec perform:sel withOptionalArgument:2.
c5455cf45678 perform:withOptional*
Claus Gittinger <cg@exept.de>
parents: 6741
diff changeset
  6417
c5455cf45678 perform:withOptional*
Claus Gittinger <cg@exept.de>
parents: 6741
diff changeset
  6418
     sel := #max:.
c5455cf45678 perform:withOptional*
Claus Gittinger <cg@exept.de>
parents: 6741
diff changeset
  6419
     rec perform:sel withOptionalArgument:2.
c5455cf45678 perform:withOptional*
Claus Gittinger <cg@exept.de>
parents: 6741
diff changeset
  6420
    "
c5455cf45678 perform:withOptional*
Claus Gittinger <cg@exept.de>
parents: 6741
diff changeset
  6421
!
c5455cf45678 perform:withOptional*
Claus Gittinger <cg@exept.de>
parents: 6741
diff changeset
  6422
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6423
performMethod:aMethod
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6424
    "invoke aMethod on the receiver.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6425
     The method should be a zero-argument method.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6426
     This is a non-object-oriented entry, applying a method
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6427
     in a functional way on a receiver.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6428
     Warning:
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6429
         Take care for the method to be appropriate for the
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6430
         receiver - no checking is done by the VM."
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6431
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6432
    ^ aMethod valueWithReceiver:self arguments:#()
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
     |mthd|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6436
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6437
     mthd := SmallInteger compiledMethodAt:#negated.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6438
     Transcript showCR:(1 performMethod:mthd)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6439
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6440
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6441
    "BAD USE example:
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6442
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6443
     |mthd|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6444
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6445
     mthd := Point compiledMethodAt:#x.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6446
     Transcript showCR:((1->2) performMethod:mthd)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6447
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6448
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6449
    "Modified: 31.7.1997 / 17:41:50 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6450
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6451
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6452
performMethod:aMethod arguments:argumentArray
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6453
    "invoke aMethod on the receiver, passing an argumentArray.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6454
     The size of the argumentArray should match the number of args
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6455
     expected by the method.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6456
     This is a non-object-oriented entry, applying a method
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6457
     in a functional way on a receiver.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6458
     Warning:
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6459
         Take care for the method to be appropriate for the
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6460
         receiver - no checking is done by the VM."
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6461
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6462
    ^ aMethod valueWithReceiver:self arguments:argumentArray
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6463
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6464
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6465
     |mthd|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6466
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6467
     mthd := SmallInteger compiledMethodAt:#+.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6468
     Transcript showCR:(1 performMethod:mthd arguments:#(2))
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6469
    "
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
    "Created: 31.7.1997 / 17:46:31 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6472
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6473
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6474
performMethod:aMethod with:arg
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6475
    "invoke aMethod on the receiver, passing an argument.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6476
     The method should be a one-argument method.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6477
     This is a non-object-oriented entry, applying a method
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6478
     in a functional way on a receiver.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6479
     Warning:
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6480
         Take care for the method to be appropriate for the
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6481
         receiver - no checking is done by the VM."
5755
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
    ^ aMethod valueWithReceiver:self arguments:(Array with:arg)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6484
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
     |mthd|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6487
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6488
     mthd := SmallInteger compiledMethodAt:#+.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6489
     Transcript showCR:(1 performMethod:mthd with:2)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6490
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6491
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6492
    "Modified: 31.7.1997 / 17:42:32 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6493
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6494
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6495
performMethod:aMethod with:arg1 with:arg2
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6496
    "invoke aMethod on the receiver, passing two arguments.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6497
     The method should be a two-argument method.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6498
     This is a non-object-oriented entry, applying a method
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6499
     in a functional way on a receiver.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6500
     Warning:
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6501
         Take care for the method to be appropriate for the
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6502
         receiver - no checking is done by the VM."
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6503
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6504
    ^ aMethod valueWithReceiver:self arguments:(Array with:arg1 with:arg2)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6505
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6506
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6507
     |mthd arr|
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
     arr := Array new:1.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6510
     mthd := Array compiledMethodAt:#basicAt:put:.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6511
     arr performMethod:mthd with:1 with:'foo'.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6512
     Transcript showCR:arr
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6513
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6514
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6515
    "Modified: 31.7.1997 / 17:44:54 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6516
!
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
performMethod:aMethod with:arg1 with:arg2 with:arg3
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6519
    "invoke aMethod on the receiver, passing three arguments.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6520
     The method should be a three-argument method.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6521
     This is a non-object-oriented entry, applying a method
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6522
     in a functional way on a receiver.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6523
     Warning:
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6524
         Take care for the method to be appropriate for the
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6525
         receiver - no checking is done by the VM."
5755
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
    ^ aMethod valueWithReceiver:self arguments:(Array with:arg1 with:arg2 with:arg3)
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
    "Created: 31.7.1997 / 17:45:20 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6530
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6531
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6532
!Object methodsFor:'printing & storing'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6533
6235
8eacf62c458e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6221
diff changeset
  6534
basicPrintOn:aStream
8eacf62c458e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6221
diff changeset
  6535
    "append the receivers className with an articel to the argument, aStream"
8eacf62c458e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6221
diff changeset
  6536
8eacf62c458e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6221
diff changeset
  6537
    aStream nextPutAll:self classNameWithArticle
8eacf62c458e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6221
diff changeset
  6538
!
8eacf62c458e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6221
diff changeset
  6539
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6540
className
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6541
    "return the classname of the receivers class"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6542
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6543
    ^ self class name
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6544
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6545
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6546
     1 className
9105
1666cb465e3f comments
Stefan Vogel <sv@exept.de>
parents: 9071
diff changeset
  6547
     1 class className 
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6548
     $a className
9105
1666cb465e3f comments
Stefan Vogel <sv@exept.de>
parents: 9071
diff changeset
  6549
     $a class className
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6550
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6551
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6552
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6553
classNameWithArticle
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6554
    "return a string consisting of classname preceeded by an article.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6555
     (dont expect me to write national variants for this ... :-)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6556
     If you have special preferences, redefine it ..."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6557
6829
db28715efb4d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6815
diff changeset
  6558
    | cls|
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6559
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6560
    (cls := self class) == self ifTrue:[
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6561
        ^ 'a funny object'
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6562
    ].
6829
db28715efb4d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6815
diff changeset
  6563
    ^ cls nameWithArticle
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6564
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6565
    "
6418
0883a068e491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6405
diff changeset
  6566
     1 classNameWithArticle   
0883a068e491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6405
diff changeset
  6567
     (1->2) classNameWithArticle    
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6568
     XWorkstation basicNew classNameWithArticle
6418
0883a068e491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6405
diff changeset
  6569
     XWorkstation classNameWithArticle 
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6570
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6571
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6572
    "Modified: 13.5.1996 / 12:16:14 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6573
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6574
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6575
errorPrint
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6576
    "print the receiver on the standard error stream."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6577
7285
76ff65cdd7e7 Stream streamErrorSignal -> StreamError
Stefan Vogel <sv@exept.de>
parents: 7266
diff changeset
  6578
    StreamError catch:[
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6579
        self printOn:Stderr
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
    "Modified: 7.3.1996 / 19:11:29 / cg"
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
errorPrintCR
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6586
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6587
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6588
    "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
  6589
7285
76ff65cdd7e7 Stream streamErrorSignal -> StreamError
Stefan Vogel <sv@exept.de>
parents: 7266
diff changeset
  6590
    StreamError catch:[
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6591
        self printOn:Stderr.
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6592
        Stderr cr
5755
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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6595
    "Modified: 7.3.1996 / 19:13:01 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6596
    "Created: 20.5.1996 / 10:20:41 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6597
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6598
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6599
errorPrintNL
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6600
    "{ Pragma: +optSpace }"
5893
f92054b38d3c Assign #obsolete resource to obsolete methods
Stefan Vogel <sv@exept.de>
parents: 5879
diff changeset
  6601
    <resource:#obsolete>
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6602
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6603
    "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
  6604
     Please use #errorPrintCR - this method exists for backward compatibility."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6605
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6606
    ^ self errorPrintCR
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6607
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6608
    "Modified: 20.5.1996 / 10:24:45 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6609
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6610
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6611
errorPrintNewline
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6612
    "{ Pragma: +optSpace }"
5893
f92054b38d3c Assign #obsolete resource to obsolete methods
Stefan Vogel <sv@exept.de>
parents: 5879
diff changeset
  6613
    <resource:#obsolete>
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6614
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6615
    "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
  6616
     Please use #errorPrintCR - this method exists for backward compatibility."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6617
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6618
    self errorPrintCR.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6619
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6620
    "Modified: 20.5.1996 / 10:24:38 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6621
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6622
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6623
infoPrint
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6624
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6625
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6626
    "print the receiver on the standard error stream.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6627
     This is meant for information messages which are not warnings
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6628
     or fatal messages.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6629
     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
  6630
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6631
    InfoPrinting == true ifTrue:[
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6632
        self errorPrint
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6633
    ]
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6634
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6635
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6636
infoPrintCR
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6637
    "{ Pragma: +optSpace }"
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
    "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
  6640
     This is meant for information messages which are not warnings
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6641
     or fatal messages.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6642
     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
  6643
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6644
    InfoPrinting == true ifTrue:[
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6645
        self errorPrintCR
5755
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
    "Created: 20.5.1996 / 10:21:28 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6649
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6650
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6651
infoPrintNL
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6652
    "{ Pragma: +optSpace }"
5893
f92054b38d3c Assign #obsolete resource to obsolete methods
Stefan Vogel <sv@exept.de>
parents: 5879
diff changeset
  6653
    <resource:#obsolete>
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6654
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6655
    "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
  6656
     Please use #infoPrintCR - this method exists for backward compatibility."
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
    ^ self infoPrintCR
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6659
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6660
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6661
print
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6662
    "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
  6663
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6664
    "/ the following allows printCR to be used during
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6665
    "/ the early init-phase, when no Stdout has been set up.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6666
    "/ (depends on string to respond to #print)
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
    Stdout isNil ifTrue:[
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6669
        self printString print.
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6670
        ^ self
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6671
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6672
    self printOn:Stdout
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
    "Modified: 4.11.1996 / 23:36:58 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6675
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6676
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6677
printCR
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6678
    "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
  6679
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6680
    "/ the following allows printCR to be used during
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6681
    "/ the early init-phase, when no Stdout has been set up.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6682
    "/ (depends on string to respond to #printCR)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6683
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6684
    Stdout isNil ifTrue:[
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6685
        self printString printCR.
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6686
        ^ self
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6687
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6688
    self printOn:Stdout.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6689
    Stdout cr
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6690
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6691
    "Created: 20.5.1996 / 10:21:37 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6692
    "Modified: 4.11.1996 / 23:37:06 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6693
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6694
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6695
printNL
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6696
    "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
  6697
     This exists for GNU Smalltalk compatibility - please use #printCR."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6698
5893
f92054b38d3c Assign #obsolete resource to obsolete methods
Stefan Vogel <sv@exept.de>
parents: 5879
diff changeset
  6699
    <resource:#obsolete>
f92054b38d3c Assign #obsolete resource to obsolete methods
Stefan Vogel <sv@exept.de>
parents: 5879
diff changeset
  6700
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6701
    ^ self printCR
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6702
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6703
    "Modified: 20.5.1996 / 10:25:31 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6704
!
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
printNewline
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6707
    "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
  6708
     This exists for backward compatibility - please use #printCR."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6709
5893
f92054b38d3c Assign #obsolete resource to obsolete methods
Stefan Vogel <sv@exept.de>
parents: 5879
diff changeset
  6710
    <resource:#obsolete>
f92054b38d3c Assign #obsolete resource to obsolete methods
Stefan Vogel <sv@exept.de>
parents: 5879
diff changeset
  6711
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6712
    self printCR
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6713
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6714
    "Modified: 20.5.1996 / 10:25:46 / cg"
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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6717
printOn:aStream
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6718
    "append a user printed representation of the receiver to aStream.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6719
     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
  6720
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6721
     The default here is to output the receivers class name.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6722
     BUT: this method is heavily redefined for objects which
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6723
     can print prettier."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6724
6235
8eacf62c458e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6221
diff changeset
  6725
    self basicPrintOn:aStream.
8eacf62c458e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6221
diff changeset
  6726
8eacf62c458e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6221
diff changeset
  6727
   "
8eacf62c458e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6221
diff changeset
  6728
    (1@2) printOn:Transcript
8eacf62c458e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6221
diff changeset
  6729
    (1@2) basicPrintOn:Transcript
8eacf62c458e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6221
diff changeset
  6730
   "
5755
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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6733
printOn:aStream leftPaddedTo:size
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6734
    "print the receiver on aStream, padding with spaces up to size.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6735
     padding is done on the left."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6736
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6737
    self printOn:aStream leftPaddedTo:size with:(Character space)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6738
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6739
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6740
     123 printOn:Transcript leftPaddedTo:10. Transcript cr
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6741
     123 printOn:Transcript leftPaddedTo:2. Transcript cr
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6742
    "
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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6745
printOn:aStream leftPaddedTo:size with:padCharacter
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6746
    "print the receiver on aStream, padding with padCharacters up to size.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6747
     padding is done on the left."
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
    aStream nextPutAll:(self printStringLeftPaddedTo:size with:padCharacter)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6750
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6751
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6752
     123 printOn:Transcript leftPaddedTo:10 with:$_ . Transcript cr
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6753
     123 printOn:Transcript leftPaddedTo:10 with:$. . Transcript cr
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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6757
printOn:aStream paddedTo:size
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6758
    "print the receiver on aStream, padding with spaces up to size."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6759
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6760
    self printOn:aStream paddedTo:size with:(Character space)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6761
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
     123.0 printOn:Transcript paddedTo:10. Transcript nextPut:$|. Transcript cr
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6764
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6765
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6766
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6767
printOn:aStream paddedTo:size with:padCharacter
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6768
    "print the receiver on aStream, padding with padCharacter up to size"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6769
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6770
    aStream nextPutAll:(self printStringPaddedTo:size with:padCharacter).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6771
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
     123 printOn:Transcript paddedTo:10 with:$_ . Transcript cr
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6774
     123 printOn:Transcript paddedTo:10 with:$. . Transcript cr
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
!
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
printOn:aStream zeroPaddedTo:size
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6779
    "print the receiver on aStream, padding with zeros up to size.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6780
     Usually used with float numbers."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6781
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6782
    self printOn:aStream paddedTo:size with:$0.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6783
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6784
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6785
     123.0 printOn:Transcript zeroPaddedTo:10
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
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6788
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6789
printRightAdjustLen:size
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6790
    "obsolete - just a name confusion.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6791
     This method will go away ..."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6792
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6793
    (self printStringLeftPaddedTo:size) printOn:Stdout
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6794
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6795
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6796
printString
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6797
    "return a string for printing the receiver.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6798
     Since we now use printOn: as the basic print mechanism,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6799
     we have to create a stream and print into it."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6800
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6801
    |s|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6802
8300
d15ead94361f Use CharacterWriteStream in #printString (speedup)
Stefan Vogel <sv@exept.de>
parents: 8287
diff changeset
  6803
    s := CharacterWriteStream on:(String basicNew:30).
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6804
    self printOn:s.
8300
d15ead94361f Use CharacterWriteStream in #printString (speedup)
Stefan Vogel <sv@exept.de>
parents: 8287
diff changeset
  6805
    ^ s contents.
7978
4ce7575e1cfc care for 16bit chars in #printString
Claus Gittinger <cg@exept.de>
parents: 7838
diff changeset
  6806
4ce7575e1cfc care for 16bit chars in #printString
Claus Gittinger <cg@exept.de>
parents: 7838
diff changeset
  6807
    "
4ce7575e1cfc care for 16bit chars in #printString
Claus Gittinger <cg@exept.de>
parents: 7838
diff changeset
  6808
     Date today printString.
4ce7575e1cfc care for 16bit chars in #printString
Claus Gittinger <cg@exept.de>
parents: 7838
diff changeset
  6809
    "
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6810
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6811
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6812
printStringLeftPaddedTo:size
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6813
    "return my printString as a right-adjusted string of length size;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6814
     characters on the left are filled with spaces.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6815
     If the printString is longer than size, 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6816
     it is returned unchanged (i.e. not truncated)"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6817
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6818
    ^ self printStringLeftPaddedTo:size with:(Character space)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6819
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6820
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6821
     10 printStringLeftPaddedTo:10
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6822
     1 printStringLeftPaddedTo:10
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6823
    "
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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6826
printStringLeftPaddedTo:size ifLarger:alternative
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6827
    "return my printString as a right-adjusted string of length size;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6828
     characters on the left are filled with spaces.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6829
     If the printString is larger than size,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6830
     return the result from evaluating alternative."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6831
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6832
    ^ self printStringLeftPaddedTo:size with:(Character space) ifLarger:alternative
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6833
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6834
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6835
     12   printStringLeftPaddedTo:3 ifLarger:['***']
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6836
     123  printStringLeftPaddedTo:3 ifLarger:['***']
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6837
     1234 printStringLeftPaddedTo:3 ifLarger:['***']
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6838
    "
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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6841
printStringLeftPaddedTo:size with:padCharacter
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6842
    "return my printString as a right-adjusted string of length size;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6843
     characters on the left are filled with padCharacter.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6844
     If the printString is longer than size, 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6845
     it is returned unchanged (i.e. not truncated)"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6846
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6847
    ^ (self printString) leftPaddedTo:size with:padCharacter
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6848
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
     123 printStringLeftPaddedTo:10 with:$.   
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6851
     1 printStringLeftPaddedTo:10 with:$.      
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6852
     (Float pi) printStringLeftPaddedTo:20 with:$*
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
!
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
printStringLeftPaddedTo:size with:padCharacter ifLarger:alternative
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6857
    "return my printString as a right-adjusted string of length size;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6858
     characters on the left are filled with padCharacter.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6859
     If the printString is larger than size,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6860
     return the result from evaluating alternative."
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
    |s|
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
    s := self printString.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6865
    s size > size ifTrue:[^ alternative value].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6866
    ^ s leftPaddedTo:size with:padCharacter
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6867
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
     12   printStringLeftPaddedTo:3 with:$. ifLarger:['***']   
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6870
     123  printStringLeftPaddedTo:3 with:$. ifLarger:['***']   
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6871
     1234 printStringLeftPaddedTo:3 with:$. ifLarger:['***']   
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6872
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6873
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6874
8576
f58f51583a34 +printStringLimitedTo:
Claus Gittinger <cg@exept.de>
parents: 8574
diff changeset
  6875
printStringLimitedTo:sizeLimit
f58f51583a34 +printStringLimitedTo:
Claus Gittinger <cg@exept.de>
parents: 8574
diff changeset
  6876
    "return a string for printing the receiver, but limit the result string in its size."
f58f51583a34 +printStringLimitedTo:
Claus Gittinger <cg@exept.de>
parents: 8574
diff changeset
  6877
f58f51583a34 +printStringLimitedTo:
Claus Gittinger <cg@exept.de>
parents: 8574
diff changeset
  6878
    |s|
f58f51583a34 +printStringLimitedTo:
Claus Gittinger <cg@exept.de>
parents: 8574
diff changeset
  6879
f58f51583a34 +printStringLimitedTo:
Claus Gittinger <cg@exept.de>
parents: 8574
diff changeset
  6880
    s := CharacterWriteStream on:(String basicNew:30).
f58f51583a34 +printStringLimitedTo:
Claus Gittinger <cg@exept.de>
parents: 8574
diff changeset
  6881
    s writeLimit:sizeLimit.
f58f51583a34 +printStringLimitedTo:
Claus Gittinger <cg@exept.de>
parents: 8574
diff changeset
  6882
    self printOn:s.
f58f51583a34 +printStringLimitedTo:
Claus Gittinger <cg@exept.de>
parents: 8574
diff changeset
  6883
    ^ s contents.
f58f51583a34 +printStringLimitedTo:
Claus Gittinger <cg@exept.de>
parents: 8574
diff changeset
  6884
f58f51583a34 +printStringLimitedTo:
Claus Gittinger <cg@exept.de>
parents: 8574
diff changeset
  6885
    "
f58f51583a34 +printStringLimitedTo:
Claus Gittinger <cg@exept.de>
parents: 8574
diff changeset
  6886
     Date today printStringLimitedTo:5.
f58f51583a34 +printStringLimitedTo:
Claus Gittinger <cg@exept.de>
parents: 8574
diff changeset
  6887
     '12345678901234567890' printStringLimitedTo:5. 
f58f51583a34 +printStringLimitedTo:
Claus Gittinger <cg@exept.de>
parents: 8574
diff changeset
  6888
    "
f58f51583a34 +printStringLimitedTo:
Claus Gittinger <cg@exept.de>
parents: 8574
diff changeset
  6889
!
f58f51583a34 +printStringLimitedTo:
Claus Gittinger <cg@exept.de>
parents: 8574
diff changeset
  6890
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6891
printStringOnError:exceptionBlock
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6892
    "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
  6893
     evaluating exceptionBlock. Useful to print something in an exceptionHandler or other
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6894
     cleanup code."
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
    |rslt|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6897
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6898
    Error handle:[:ex |
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6899
        rslt := exceptionBlock value
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6900
    ] do:[
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  6901
        rslt := self printString
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6902
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6903
    ^ rslt
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6904
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6905
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6906
printStringPaddedTo:size
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6907
    "return a printed representation of the receiver,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6908
     padded with spaces (at the right) up to size.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6909
     If the printString is longer than size, 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6910
     it is returned unchanged (i.e. not truncated)"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6911
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6912
    ^ self printStringPaddedTo:size with:(Character space)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6913
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6914
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6915
     123 printStringPaddedTo:10    
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6916
     1234567890123456 printStringPaddedTo:10  
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6917
     'hello' printStringPaddedTo:10   
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6918
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6919
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6920
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6921
printStringPaddedTo:size ifLarger:alternative
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6922
    "return a printed representation of the receiver,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6923
     padded with spaces (at the right) up to size.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6924
     If the resulting printString is too large, 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6925
     return the result from evaluating alternative."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6926
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6927
    ^ self printStringPaddedTo:size with:(Character space) ifLarger:alternative
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6928
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6929
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6930
     12   printStringPaddedTo:3 ifLarger:['***']   
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6931
     123  printStringPaddedTo:3 ifLarger:['***']   
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6932
     1234 printStringPaddedTo:3 ifLarger:['***']   
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6933
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6934
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6935
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6936
printStringPaddedTo:size with:padCharacter
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6937
    "return a printed representation of the receiver,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6938
     padded with padCharacter (at the right) up to size.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6939
     If the printString is longer than size, 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6940
     it is returned unchanged (i.e. not truncated)"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6941
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6942
    ^ (self printString) paddedTo:size with:padCharacter
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6943
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6944
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6945
     123  printStringPaddedTo:10 with:$.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6946
     123  printStringPaddedTo:10 with:$*
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6947
     123  printStringPaddedTo:3 with:$*   
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6948
     1234 printStringPaddedTo:3 with:$*   
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6949
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6950
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6951
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6952
printStringPaddedTo:size with:padCharacter ifLarger:alternative
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6953
    "return a printed representation of the receiver,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6954
     padded with padCharacter (at the right) up to size.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6955
     If the resulting printString is too large, 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6956
     return the result from evaluating alternative."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6957
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6958
    |s|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6959
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6960
    s := self printString.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6961
    s size > size ifTrue:[^ alternative value].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6962
    ^ s paddedTo:size with:padCharacter
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6963
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6964
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6965
     123   printStringPaddedTo:3 with:$. ifLarger:['***']
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6966
     12345 printStringPaddedTo:3 with:$. ifLarger:['***']
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6967
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6968
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6969
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6970
printStringRightAdjustLen:size
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6971
    "obsolete - just a name confusion.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6972
     This method will go away ..."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6973
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6974
    ^ self printStringLeftPaddedTo:size
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6975
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6976
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6977
printStringZeroPaddedTo:size
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6978
    "return a printed representation of the receiver, 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6979
     padded with zero (at the right) characters up to size.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6980
     Usually used with float numbers."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6981
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6982
    ^ self printStringPaddedTo:size with:$0
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6983
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6984
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6985
     123.0 printStringZeroPaddedTo:10 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6986
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6987
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6988
8287
9770f4ad54ff +printfPrintString
werner
parents: 8273
diff changeset
  6989
printfPrintString:ignoredFormat
9770f4ad54ff +printfPrintString
werner
parents: 8273
diff changeset
  6990
    "fallback to default printString
9770f4ad54ff +printfPrintString
werner
parents: 8273
diff changeset
  6991
     (for compatibility with float and integer-printing)"
9770f4ad54ff +printfPrintString
werner
parents: 8273
diff changeset
  6992
9770f4ad54ff +printfPrintString
werner
parents: 8273
diff changeset
  6993
    ^ self printString
9770f4ad54ff +printfPrintString
werner
parents: 8273
diff changeset
  6994
!
9770f4ad54ff +printfPrintString
werner
parents: 8273
diff changeset
  6995
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6996
store
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6997
    "store the receiver on standard output.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6998
     this method is useless, but included for compatibility."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6999
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7000
    self storeOn:Stdout
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7001
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7002
7600
5a3fee21c032 #storeString - omit # from Symbols and Arrays that are elements of an array.
Stefan Vogel <sv@exept.de>
parents: 7576
diff changeset
  7003
storeArrayElementOn:aStream
5a3fee21c032 #storeString - omit # from Symbols and Arrays that are elements of an array.
Stefan Vogel <sv@exept.de>
parents: 7576
diff changeset
  7004
    "store an object as an Array element.
5a3fee21c032 #storeString - omit # from Symbols and Arrays that are elements of an array.
Stefan Vogel <sv@exept.de>
parents: 7576
diff changeset
  7005
     Subclasses may redefine this to omit a leading '#'"
5a3fee21c032 #storeString - omit # from Symbols and Arrays that are elements of an array.
Stefan Vogel <sv@exept.de>
parents: 7576
diff changeset
  7006
5a3fee21c032 #storeString - omit # from Symbols and Arrays that are elements of an array.
Stefan Vogel <sv@exept.de>
parents: 7576
diff changeset
  7007
    ^ self storeOn:aStream
5a3fee21c032 #storeString - omit # from Symbols and Arrays that are elements of an array.
Stefan Vogel <sv@exept.de>
parents: 7576
diff changeset
  7008
!
5a3fee21c032 #storeString - omit # from Symbols and Arrays that are elements of an array.
Stefan Vogel <sv@exept.de>
parents: 7576
diff changeset
  7009
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7010
storeCR
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7011
    "store the receiver on standard output; append a carriage return."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7012
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7013
    self store.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7014
    Character cr print
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7015
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7016
    "Created: 20.5.1996 / 10:26:01 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7017
    "Modified: 20.5.1996 / 10:26:57 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7018
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7019
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7020
storeNl
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7021
    "store the receiver on standard output; append a newline.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7022
     This method is included for backward compatibility-  use #storeCR."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7023
5893
f92054b38d3c Assign #obsolete resource to obsolete methods
Stefan Vogel <sv@exept.de>
parents: 5879
diff changeset
  7024
    <resource:#obsolete>
f92054b38d3c Assign #obsolete resource to obsolete methods
Stefan Vogel <sv@exept.de>
parents: 5879
diff changeset
  7025
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7026
    self storeCR.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7027
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7028
    "Modified: 20.5.1996 / 10:26:49 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7029
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7030
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7031
storeOn:aStream
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7032
    "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
  7033
     reconstruct the receiver.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7034
     Notice, that no self referencing or cyclic objects can be represented
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7035
     in this format.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7036
     Use storeBinaryOn:, which handles these cases correctly."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7037
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7038
    |myClass hasSemi sz "{ Class: SmallInteger }" |
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
    thisContext isRecursive ifTrue:[
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7041
        Object recursiveStoreStringSignal raiseRequestWith:self.
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7042
        ('Object [error]: storeString of self referencing object.') errorPrintCR.
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7043
        aStream nextPutAll:'#("recursive")'.
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7044
        ^ self
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7045
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7046
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7047
    myClass := self class.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7048
    aStream nextPut:$(.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7049
    aStream nextPutAll:self class name.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7050
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7051
    hasSemi := false.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7052
    myClass isVariable ifTrue:[
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7053
        aStream nextPutAll:' basicNew:'.
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7054
        self basicSize printOn:aStream
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7055
    ] ifFalse:[
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7056
        aStream nextPutAll:' basicNew'
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
    sz := myClass instSize.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7060
    1 to:sz do:[:i | 
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7061
        aStream nextPutAll:' instVarAt:'.
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7062
        i printOn:aStream.
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7063
        aStream nextPutAll:' put:'.
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7064
        (self instVarAt:i) storeOn:aStream.
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7065
        aStream nextPut:$;.
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7066
        hasSemi := true
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7067
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7068
    myClass isVariable ifTrue:[
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7069
        sz := self basicSize.
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7070
        1 to:sz do:[:i | 
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7071
            aStream nextPutAll:' basicAt:'.
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7072
            i printOn:aStream.
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7073
            aStream nextPutAll:' put:'.
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7074
            (self basicAt:i) storeOn:aStream.
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7075
            aStream nextPut:$;.
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7076
            hasSemi := true
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7077
        ]
5755
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
    hasSemi ifTrue:[
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7080
        aStream nextPutAll:' yourself'
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7081
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7082
    aStream nextPut:$).
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
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7085
     |s|
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
     s := WriteStream on:(String new).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7088
     ('hello' -> 'world') storeOn:s.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7089
     s := ReadStream on:(s contents).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7090
     (Object readFrom:s) inspect
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
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7093
     |s|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7094
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7095
     s := 'data' asFilename writeStream.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7096
     ('hello' -> 'world') storeOn:s.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7097
     s close.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7098
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7099
     s := 'data' asFilename readStream.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7100
     (Object readFrom:s) inspect
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7101
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7102
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7103
    "does not work example:"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7104
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7105
     |s a|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7106
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7107
     a := Array new:2.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7108
     a at:1 put:a.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7109
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7110
     s := 'data' asFilename writeStream.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7111
     a storeOn:s.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7112
     s close.
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
     s := 'data' asFilename readStream.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7115
     (Object readFrom:s) inspect
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7116
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7117
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7118
    "Modified: 28.1.1997 / 00:36:12 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7119
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7120
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7121
storeString
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7122
    "return a string representing an expression to reconstruct the receiver.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7123
     Notice, that no self referencing or cyclic objects can be represented
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7124
     in this format.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7125
     Use storeBinaryOn:, which handles these cases correctly."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7126
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7127
    |s|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7128
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7129
    s := WriteStream on:(String new:50).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7130
    self storeOn:s.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7131
    ^ s contents
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7132
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7133
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7134
!Object methodsFor:'queries'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7135
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7136
basicSize
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7137
    "return the number of the receivers indexed instance variables,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7138
     0 if it has none.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7139
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7140
     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
  7141
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7142
%{  /* NOCONTEXT */
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7143
8909
485a8e3153e0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  7144
    REGISTER INT nbytes;
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7145
    REGISTER OBJ myClass;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7146
    int nInstBytes;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7147
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7148
    /*
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7149
     * notice the missing test for self being a nonNilObject -
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7150
     * this can be done since basicSize is defined both in UndefinedObject
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7151
     * and SmallInteger
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7152
     */
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7153
    myClass = __qClass(self);
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7154
    nbytes = __qSize(self);
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7155
    nInstBytes = OHDR_SIZE + __OBJS2BYTES__( __intVal(__ClassInstPtr(myClass)->c_ninstvars) );
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7156
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7157
    switch ((INT)(__ClassInstPtr(myClass)->c_flags) & __MASKSMALLINT(ARRAYMASK)) {
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7158
        case __MASKSMALLINT(POINTERARRAY):
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7159
        case __MASKSMALLINT(WKPOINTERARRAY):
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7160
            nbytes -= nInstBytes;
8913
b9498d27a554 64bit; mkSmallInteger
Claus Gittinger <cg@exept.de>
parents: 8909
diff changeset
  7161
            RETURN ( __mkSmallInteger(__BYTES2OBJS__(nbytes)) );
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7162
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7163
        case __MASKSMALLINT(BYTEARRAY):
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7164
            nbytes -= nInstBytes;
8913
b9498d27a554 64bit; mkSmallInteger
Claus Gittinger <cg@exept.de>
parents: 8909
diff changeset
  7165
            RETURN ( __mkSmallInteger(nbytes / sizeof(char)) );
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7166
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7167
        case __MASKSMALLINT(FLOATARRAY):
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7168
            nbytes -= nInstBytes;
8913
b9498d27a554 64bit; mkSmallInteger
Claus Gittinger <cg@exept.de>
parents: 8909
diff changeset
  7169
            RETURN ( __mkSmallInteger(nbytes / sizeof(float)) );
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7170
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7171
        case __MASKSMALLINT(DOUBLEARRAY):
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7172
#ifdef __NEED_DOUBLE_ALIGN
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7173
            nInstBytes = (nInstBytes-1+__DOUBLE_ALIGN) &~ (__DOUBLE_ALIGN-1);
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7174
#endif
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7175
            nbytes -= nInstBytes;
8913
b9498d27a554 64bit; mkSmallInteger
Claus Gittinger <cg@exept.de>
parents: 8909
diff changeset
  7176
            RETURN ( __mkSmallInteger(nbytes / sizeof(double)) );
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7177
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7178
        case __MASKSMALLINT(WORDARRAY):
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7179
        case __MASKSMALLINT(SWORDARRAY):
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7180
            nbytes -= nInstBytes;
8913
b9498d27a554 64bit; mkSmallInteger
Claus Gittinger <cg@exept.de>
parents: 8909
diff changeset
  7181
            RETURN ( __mkSmallInteger(nbytes>>1) ); /* notice the hardcoded 2 here - not sizeof(short) */
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7182
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7183
        case __MASKSMALLINT(LONGARRAY):
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7184
        case __MASKSMALLINT(SLONGARRAY):
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7185
            nbytes -= nInstBytes;
8913
b9498d27a554 64bit; mkSmallInteger
Claus Gittinger <cg@exept.de>
parents: 8909
diff changeset
  7186
            RETURN ( __mkSmallInteger(nbytes>>2) ); /* notice the hardcoded 4 here - not sizeof(int) */
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7187
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7188
        case __MASKSMALLINT(LONGLONGARRAY):
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7189
        case __MASKSMALLINT(SLONGLONGARRAY):
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7190
#ifdef __NEED_LONGLONG_ALIGN
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7191
            nInstBytes = (nInstBytes-1+__LONGLONG_ALIGN) &~ (__LONGLONG_ALIGN-1);
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7192
#endif
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7193
            nbytes -= nInstBytes;
8913
b9498d27a554 64bit; mkSmallInteger
Claus Gittinger <cg@exept.de>
parents: 8909
diff changeset
  7194
            RETURN ( __mkSmallInteger(nbytes>>3) ); /* notice the hardcoded 8 here - not sizeof(long long) */
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7195
    }
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7196
%}.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7197
    ^ 0
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7198
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7199
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7200
byteSize
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7201
    "return the number of bytes in the receivers indexed instance variables,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7202
     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
  7203
     instvars i.e. byteArrays, wordArrays etc.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7204
     Notice: for Strings the returned size may look strange.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7205
     Only useful with binary storage."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7206
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7207
    |myClass|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7208
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7209
    myClass := self class.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7210
    myClass isVariable ifTrue:[
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7211
        myClass isPointers ifFalse:[
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7212
            myClass isBytes ifTrue:[
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7213
                ^ self basicSize.
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7214
            ].
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7215
            myClass isWords ifTrue:[
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7216
                ^ self basicSize * 2.
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7217
            ].
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7218
            myClass isSignedWords ifTrue:[
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7219
                ^ self basicSize * 2.
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7220
            ].
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7221
            myClass isLongs ifTrue:[
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7222
                ^ self basicSize * 4.
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7223
            ].
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7224
            myClass isSignedLongs ifTrue:[
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7225
                ^ self basicSize * 4.
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7226
            ].
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7227
            myClass isLongLongs ifTrue:[
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7228
                ^ self basicSize * 8.
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7229
            ].
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7230
            myClass isSignedLongLongs ifTrue:[
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7231
                ^ self basicSize * 8.
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7232
            ].
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7233
            myClass isFloats ifTrue:[
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7234
                ^ self basicSize * (ExternalBytes sizeofFloat)
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7235
            ].
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7236
            myClass isDoubles ifTrue:[
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7237
                ^ self basicSize * (ExternalBytes sizeofDouble)
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7238
            ].
8789
4872313c787a Error handling in #byteSize
Stefan Vogel <sv@exept.de>
parents: 8729
diff changeset
  7239
            self error:'unknown variable size class species'.
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7240
        ]
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7241
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7242
    ^ 0
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7243
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
     Point new byteSize   
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7246
     'hello' byteSize     
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7247
     (ByteArray with:1 with:2) byteSize 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7248
     (FloatArray with:1.5) byteSize    
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7249
     (DoubleArray with:1.5) byteSize    
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7250
     (WordArray with:1 with:2) byteSize    
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
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7253
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7254
class
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7255
    "return the receivers class"
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
%{  /* NOCONTEXT */
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7258
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7259
    RETURN ( __Class(self) );
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
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7262
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7263
respondsTo:aSelector
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7264
    "return true, if the receiver implements a method with selector equal
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7265
     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
  7266
     receivers class or one of its superclasses.
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
     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
  7269
     an error being raised. For example, an implementation could send
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7270
     #shouldNotImplement or #subclassResponsibility."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7271
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
     should we go via the cache, or search (by class) ?
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7274
     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
  7275
     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
  7276
     For now, use the cache ...
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
%{  /* NOCONTEXT */
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7279
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7280
    if (__lookup(__Class(self), aSelector) == nil) {
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7281
        RETURN ( false );
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7282
    }
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7283
    RETURN ( true );
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
.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7286
    ^ self class canUnderstand:aSelector
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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7289
    "'aString' respondsTo:#+"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7290
    "'aString' respondsTo:#,"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7291
    "'aString' respondsTo:#collect:"
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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7294
respondsToArithmetic
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7295
    "return true, if the receiver responds to arithmetic messages.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7296
     false is returned here - the method is redefined in ArithmeticValue."
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
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7299
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7300
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7301
size
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7302
    "return the number of the receivers indexed instance variables;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7303
     this method may be redefined in subclasses"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7304
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7305
    ^ self basicSize
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
species
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7309
    "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
  7310
     This is used to create an appropriate object when creating derived
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7311
     copies in the collection classes (sometimes redefined)."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7312
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7313
    ^ self class
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7314
!
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
yourself
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7317
    "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
  7318
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7319
    ^ self
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7320
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7321
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7322
!Object methodsFor:'secure message sending'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7323
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7324
askFor:aSelector
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7325
    "try to send the receiver the message, aSelector.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7326
     If it does not understand it, return false. 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7327
     Otherwise the real value returned.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7328
     Useful to send messages such as: #isColor to unknown
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7329
     receivers."
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
    ^ self perform:aSelector ifNotUnderstood:[false]
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7332
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7333
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7334
     1 askFor:#isColor     
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7335
     Color red askFor:#isColor 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7336
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7337
     1 askFor:#isFoo     
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7338
     Color red askFor:#isFoo 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7339
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7340
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7341
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7342
perform:aSelector ifNotUnderstood:exceptionBlock
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7343
    "try to send message aSelector to the receiver.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7344
     If its understood, return the methods returned value,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7345
     otherwise return the value of the exceptionBlock"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7346
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7347
    |val ok|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7348
6146
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
  7349
    MessageNotUnderstood handle:[:ex |
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7350
        "/ reject, if the bad message is not the one
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7351
        "/ we have sent originally
8502
7720740cf40f Use MessageNotUnderstood>>#selector
Stefan Vogel <sv@exept.de>
parents: 8500
diff changeset
  7352
        ex selector == aSelector ifFalse:[
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7353
            ex reject
6741
c16f744e4536 reject in *ifNotUnderstood, if the message is not the one for myself
Claus Gittinger <cg@exept.de>
parents: 6728
diff changeset
  7354
        ].
c16f744e4536 reject in *ifNotUnderstood, if the message is not the one for myself
Claus Gittinger <cg@exept.de>
parents: 6728
diff changeset
  7355
        ex receiver == self ifFalse:[
c16f744e4536 reject in *ifNotUnderstood, if the message is not the one for myself
Claus Gittinger <cg@exept.de>
parents: 6728
diff changeset
  7356
            ex reject
8413
4220f5bb3a39 *** empty log message ***
ca
parents: 8409
diff changeset
  7357
        ].
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7358
    ] do:[
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7359
        val := self perform:aSelector.
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7360
        ok := true.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7361
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7362
    ok isNil ifTrue:[
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7363
        ^ exceptionBlock value
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7364
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7365
    ^ val
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7366
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7367
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7368
     1.2345 perform:#foo ifNotUnderstood:['sorry'] 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7369
     1.2345 perform:#sqrt ifNotUnderstood:['sorry'] 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7370
     12345 perform:#sqrt ifNotUnderstood:['sorry']  
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7371
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7372
!
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
perform:aSelector with:argument ifNotUnderstood:exceptionBlock
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7375
    "try to send message aSelector to the receiver.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7376
     If its understood, return the methods returned value,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7377
     otherwise return the value of the exceptionBlock"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7378
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7379
    |val ok|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7380
8939
ac97eb450b97 Fix examples in #perform:*ifNotUnderstood:
Stefan Vogel <sv@exept.de>
parents: 8935
diff changeset
  7381
    MessageNotUnderstood handle:[:ex |
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7382
        "/ reject, if the bad message is not the one
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7383
        "/ we have sent originally
8939
ac97eb450b97 Fix examples in #perform:*ifNotUnderstood:
Stefan Vogel <sv@exept.de>
parents: 8935
diff changeset
  7384
        ex selector == aSelector ifFalse:[
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7385
            ex reject
6741
c16f744e4536 reject in *ifNotUnderstood, if the message is not the one for myself
Claus Gittinger <cg@exept.de>
parents: 6728
diff changeset
  7386
        ].
c16f744e4536 reject in *ifNotUnderstood, if the message is not the one for myself
Claus Gittinger <cg@exept.de>
parents: 6728
diff changeset
  7387
        ex receiver == self ifFalse:[
c16f744e4536 reject in *ifNotUnderstood, if the message is not the one for myself
Claus Gittinger <cg@exept.de>
parents: 6728
diff changeset
  7388
            ex reject
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7389
        ]
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7390
    ] do:[
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7391
        val := self perform:aSelector with:argument.
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7392
        ok := true.
5755
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
    ok isNil ifTrue:[
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7395
        ^ exceptionBlock value
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7396
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7397
    ^ val
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7398
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7399
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7400
     |unknown|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7401
8939
ac97eb450b97 Fix examples in #perform:*ifNotUnderstood:
Stefan Vogel <sv@exept.de>
parents: 8935
diff changeset
  7402
     unknown := 4.
ac97eb450b97 Fix examples in #perform:*ifNotUnderstood:
Stefan Vogel <sv@exept.de>
parents: 8935
diff changeset
  7403
     (unknown perform:#- with:2 ifNotUnderstood:['sorry']) printNewline.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7404
     unknown := 'high there'.
8939
ac97eb450b97 Fix examples in #perform:*ifNotUnderstood:
Stefan Vogel <sv@exept.de>
parents: 8935
diff changeset
  7405
     (unknown perform:#- with:2 ifNotUnderstood:['sorry']) printNewline.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7406
    "
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
5926
e5ce56a2bd40 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5912
diff changeset
  7409
perform:aSelector with:arg1 with:arg2 ifNotUnderstood:exceptionBlock
e5ce56a2bd40 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5912
diff changeset
  7410
    "try to send message aSelector to the receiver.
e5ce56a2bd40 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5912
diff changeset
  7411
     If its understood, return the methods returned value,
e5ce56a2bd40 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5912
diff changeset
  7412
     otherwise return the value of the exceptionBlock"
e5ce56a2bd40 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5912
diff changeset
  7413
e5ce56a2bd40 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5912
diff changeset
  7414
    |val ok|
e5ce56a2bd40 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5912
diff changeset
  7415
8939
ac97eb450b97 Fix examples in #perform:*ifNotUnderstood:
Stefan Vogel <sv@exept.de>
parents: 8935
diff changeset
  7416
    MessageNotUnderstood handle:[:ex |
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7417
        "/ reject, if the bad message is not the one
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7418
        "/ we have sent originally
8939
ac97eb450b97 Fix examples in #perform:*ifNotUnderstood:
Stefan Vogel <sv@exept.de>
parents: 8935
diff changeset
  7419
        ex selector == aSelector ifFalse:[
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7420
            ex reject
6741
c16f744e4536 reject in *ifNotUnderstood, if the message is not the one for myself
Claus Gittinger <cg@exept.de>
parents: 6728
diff changeset
  7421
        ].
c16f744e4536 reject in *ifNotUnderstood, if the message is not the one for myself
Claus Gittinger <cg@exept.de>
parents: 6728
diff changeset
  7422
        ex receiver == self ifFalse:[
c16f744e4536 reject in *ifNotUnderstood, if the message is not the one for myself
Claus Gittinger <cg@exept.de>
parents: 6728
diff changeset
  7423
            ex reject
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7424
        ]
5926
e5ce56a2bd40 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5912
diff changeset
  7425
    ] do:[
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7426
        val := self perform:aSelector with:arg1 with:arg2.
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7427
        ok := true.
5926
e5ce56a2bd40 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5912
diff changeset
  7428
    ].
e5ce56a2bd40 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5912
diff changeset
  7429
    ok isNil ifTrue:[
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7430
        ^ exceptionBlock value
5926
e5ce56a2bd40 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5912
diff changeset
  7431
    ].
e5ce56a2bd40 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5912
diff changeset
  7432
    ^ val
e5ce56a2bd40 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5912
diff changeset
  7433
!
e5ce56a2bd40 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5912
diff changeset
  7434
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7435
perform:aSelector withArguments:argumentArray ifNotUnderstood:exceptionBlock
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7436
    "try to send message aSelector to the receiver.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7437
     If its understood, return the methods returned value,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7438
     otherwise return the value of the exceptionBlock"
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
    |val ok|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7441
8939
ac97eb450b97 Fix examples in #perform:*ifNotUnderstood:
Stefan Vogel <sv@exept.de>
parents: 8935
diff changeset
  7442
    MessageNotUnderstood handle:[:ex |
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7443
        "/ reject, if the bad message is not the one
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7444
        "/ we have sent originally
8939
ac97eb450b97 Fix examples in #perform:*ifNotUnderstood:
Stefan Vogel <sv@exept.de>
parents: 8935
diff changeset
  7445
        ex selector == aSelector ifFalse:[
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7446
            ex reject
6741
c16f744e4536 reject in *ifNotUnderstood, if the message is not the one for myself
Claus Gittinger <cg@exept.de>
parents: 6728
diff changeset
  7447
        ].
c16f744e4536 reject in *ifNotUnderstood, if the message is not the one for myself
Claus Gittinger <cg@exept.de>
parents: 6728
diff changeset
  7448
        ex receiver == self ifFalse:[
c16f744e4536 reject in *ifNotUnderstood, if the message is not the one for myself
Claus Gittinger <cg@exept.de>
parents: 6728
diff changeset
  7449
            ex reject
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7450
        ]
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7451
    ] do:[
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7452
        val := self perform:aSelector withArguments:argumentArray.
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7453
        ok := true.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7454
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7455
    ok isNil ifTrue:[
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7456
        ^ exceptionBlock value
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7457
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7458
    ^ val
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7459
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7460
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7461
     |unknown|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7462
8939
ac97eb450b97 Fix examples in #perform:*ifNotUnderstood:
Stefan Vogel <sv@exept.de>
parents: 8935
diff changeset
  7463
     unknown := 4.
ac97eb450b97 Fix examples in #perform:*ifNotUnderstood:
Stefan Vogel <sv@exept.de>
parents: 8935
diff changeset
  7464
     (unknown perform:#- withArguments:#(2) ifNotUnderstood:['sorry']) printNewline.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7465
     unknown := 'high there'.
8939
ac97eb450b97 Fix examples in #perform:*ifNotUnderstood:
Stefan Vogel <sv@exept.de>
parents: 8935
diff changeset
  7466
     (unknown perform:#- withArguments:#(2) ifNotUnderstood:['sorry']) printNewline.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7467
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7468
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7469
    "Modified: 27.3.1997 / 14:13:16 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7470
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7471
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7472
!Object methodsFor:'signal constants'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7473
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7474
messageNotUnderstoodSignal
6146
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
  7475
    ^ MessageNotUnderstood
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7476
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7477
    "Created: 6.3.1997 / 15:46:52 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7478
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7479
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7480
!Object methodsFor:'special queries'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7481
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7482
allOwners
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7483
    "return a collection of all objects referencing the receiver"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7484
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7485
    ^ ObjectMemory whoReferences:self
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7486
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7487
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7488
references:anObject
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7489
    "return true, if the receiver refers to the argument, anObject.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7490
     - for debugging only"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7491
6074
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7492
    ^ self referencesObject:anObject
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7493
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
     |v|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7496
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7497
     v := View new initialize.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7498
     v references:Display. 
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
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7501
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7502
referencesAny:aCollection
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7503
    "return true, if the receiver refers to any object from 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7504
     the argument, aCollection.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7505
     - for debugging only"
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
    OBJ cls, flags;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7509
    int nInsts, inst;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7510
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7511
    if (! __isNonNilObject(self)) {
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7512
        RETURN (false);
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7513
    }
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7514
8934
32a063645991 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8930
diff changeset
  7515
    if (__isArrayLike(aCollection)) {
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7516
        int nObjs = __arraySize(aCollection);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7517
        char *minAddr = 0, *maxAddr = 0;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7518
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7519
        if (nObjs == 0) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7520
            RETURN (false);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7521
        }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7522
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7523
        /*
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7524
         * a little optimization: use the fact that all old objects
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7525
         * refering to a new object are on the remSet; if I am not,
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7526
         * a trivial reject is possible, if all objects are newbees.
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7527
         * as a side effect, gather min/max addresses
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7528
         */
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7529
        if ((__qSpace(self) <= OLDSPACE) && !__isRemembered(self)) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7530
            int allNewBees = 1;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7531
            int i;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7532
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7533
            minAddr = (char *)(__ArrayInstPtr(aCollection)->a_element[0]);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7534
            maxAddr = minAddr;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7535
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7536
            for (i=0; i<nObjs; i++) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7537
                OBJ anObject;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7538
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7539
                anObject = __ArrayInstPtr(aCollection)->a_element[i];
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7540
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7541
                if (__isNonNilObject(anObject)) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7542
                    int spc;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7543
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7544
                    if (((spc = __qSpace(anObject)) != NEWSPACE) && (spc != SURVSPACE)) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7545
                        allNewBees = 0;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7546
                    }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7547
                }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7548
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7549
                if ((char *)anObject < minAddr) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7550
                    minAddr = (char *)anObject;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7551
                } else if ((char *)anObject > maxAddr) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7552
                    maxAddr = (char *)anObject;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7553
                }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7554
            }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7555
            if (allNewBees) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7556
                RETURN (false);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7557
            }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7558
        }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7559
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7560
        /*
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7561
         * fetch min/max in searchList (if not already done)
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7562
         */
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7563
        if (minAddr == 0) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7564
            int i;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7565
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7566
            for (i=0; i<nObjs; i++) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7567
                OBJ anObject;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7568
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7569
                anObject = __ArrayInstPtr(aCollection)->a_element[i];
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7570
                if ((char *)anObject < minAddr) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7571
                    minAddr = (char *)anObject;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7572
                } else if ((char *)anObject > maxAddr) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7573
                    maxAddr = (char *)anObject;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7574
                }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7575
            }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7576
        }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7577
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7578
        cls = __qClass(self);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7579
        if (((char *)cls >= minAddr) && ((char *)cls <= maxAddr)) {
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7580
#if defined(memsrch4)
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7581
            if (memsrch4(__arrayVal(aCollection), (INT)cls, nObjs)) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7582
                RETURN (true);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7583
            }
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7584
#else
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7585
            int i;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7586
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7587
            for (i=0; i<nObjs; i++) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7588
                OBJ anObject;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7589
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7590
                anObject = __ArrayInstPtr(aCollection)->a_element[i];
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7591
                if (cls == anObject) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7592
                    RETURN (true);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7593
                }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7594
            }
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7595
#endif /* memsrch4 */
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7596
        }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7597
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7598
        flags = __ClassInstPtr(cls)->c_flags;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7599
        if (((INT)flags & __MASKSMALLINT(ARRAYMASK)) == __MASKSMALLINT(POINTERARRAY)) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7600
            nInsts = __BYTES2OBJS__(__qSize(self) - OHDR_SIZE);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7601
        } else {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7602
            nInsts = __intVal(__ClassInstPtr(cls)->c_ninstvars);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7603
        }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7604
        if (! nInsts) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7605
            RETURN (false);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7606
        }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7607
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7608
        if (nObjs == 1) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7609
            /* better reverse the loop */
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7610
            OBJ anObject;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7611
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7612
            anObject = __ArrayInstPtr(aCollection)->a_element[0];
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7613
#if defined(memsrch4)
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7614
            if (memsrch4(__InstPtr(self)->i_instvars, (INT)anObject, nInsts)) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7615
                RETURN (true);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7616
            }
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7617
#else
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7618
            for (inst=0; inst<nInsts; inst++) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7619
                if ((__InstPtr(self)->i_instvars[inst]) == anObject) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7620
                    RETURN (true);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7621
                }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7622
            }
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7623
#endif
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7624
            RETURN (false);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7625
        }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7626
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7627
        for (inst=0; inst<nInsts; inst++) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7628
            OBJ instVar = __InstPtr(self)->i_instvars[inst];
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7629
            int i;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7630
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7631
            if (((char *)instVar >= minAddr) && ((char *)instVar <= maxAddr)) {
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7632
#if defined(memsrch4)
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7633
                if (memsrch4(__arrayVal(aCollection), (INT)instVar, nObjs)) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7634
                    RETURN (true);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7635
                }
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7636
#else
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7637
                for (i=0; i<nObjs; i++) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7638
                    OBJ anObject;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7639
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7640
                    anObject = __ArrayInstPtr(aCollection)->a_element[i];
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7641
                    if (instVar == anObject) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7642
                        RETURN (true);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7643
                    }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7644
                }
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7645
#endif /* memsrch4 */
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7646
            }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7647
        }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7648
        RETURN (false);
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7649
    }
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
    aCollection do:[:el |
8555
2bff17ee9c22 Use #referencesObject instead of #references:
Stefan Vogel <sv@exept.de>
parents: 8546
diff changeset
  7653
        (self referencesObject:el) ifTrue:[^ true].
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7654
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7655
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7656
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7657
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7658
referencesDerivedInstanceOf:aClass
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7659
    "return true, if the receiver refers to an instance of
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7660
     the argument, aClass or its subclass. This method exists
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7661
     to support searching for users of a class."
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
    |myClass 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7664
     numInst "{ Class: SmallInteger }" |
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7665
6631
5ffa1ce7b2cc #isExceptionCreator instead of #isSignal
Stefan Vogel <sv@exept.de>
parents: 6600
diff changeset
  7666
    "check the class"
5ffa1ce7b2cc #isExceptionCreator instead of #isSignal
Stefan Vogel <sv@exept.de>
parents: 6600
diff changeset
  7667
    (self isKindOf:aClass) ifTrue:[^ true].
5ffa1ce7b2cc #isExceptionCreator instead of #isSignal
Stefan Vogel <sv@exept.de>
parents: 6600
diff changeset
  7668
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7669
    myClass := self class.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7670
    "check the instance variables"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7671
    numInst := myClass instSize.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7672
    1 to:numInst do:[:i | 
6631
5ffa1ce7b2cc #isExceptionCreator instead of #isSignal
Stefan Vogel <sv@exept.de>
parents: 6600
diff changeset
  7673
        ((self instVarAt:i) isKindOf:aClass) ifTrue:[^ true]
5755
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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7676
    "check the indexed variables"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7677
    myClass isVariable ifTrue:[
6631
5ffa1ce7b2cc #isExceptionCreator instead of #isSignal
Stefan Vogel <sv@exept.de>
parents: 6600
diff changeset
  7678
        myClass isPointers ifFalse:[
5ffa1ce7b2cc #isExceptionCreator instead of #isSignal
Stefan Vogel <sv@exept.de>
parents: 6600
diff changeset
  7679
            "no need to search in non pointer fields"
5ffa1ce7b2cc #isExceptionCreator instead of #isSignal
Stefan Vogel <sv@exept.de>
parents: 6600
diff changeset
  7680
            ((aClass == Number) or:[aClass isSubclassOf:Number]) ifFalse:[^ false].
5ffa1ce7b2cc #isExceptionCreator instead of #isSignal
Stefan Vogel <sv@exept.de>
parents: 6600
diff changeset
  7681
        ].
5ffa1ce7b2cc #isExceptionCreator instead of #isSignal
Stefan Vogel <sv@exept.de>
parents: 6600
diff changeset
  7682
        numInst := self basicSize.
5ffa1ce7b2cc #isExceptionCreator instead of #isSignal
Stefan Vogel <sv@exept.de>
parents: 6600
diff changeset
  7683
        1 to:numInst do:[:i | 
5ffa1ce7b2cc #isExceptionCreator instead of #isSignal
Stefan Vogel <sv@exept.de>
parents: 6600
diff changeset
  7684
            ((self basicAt:i) isKindOf:aClass) ifTrue:[^ true]
5ffa1ce7b2cc #isExceptionCreator instead of #isSignal
Stefan Vogel <sv@exept.de>
parents: 6600
diff changeset
  7685
        ]
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7686
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7687
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7688
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7689
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7690
     (1 @ 3.4) referencesDerivedInstanceOf:Number  
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7691
     (1 @ 3.4) referencesDerivedInstanceOf:Array   
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7692
     View new initialize referencesDerivedInstanceOf:DeviceWorkstation  
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7693
    "
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
9279
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  7696
referencesForWhich:checkBlock do:actionBlock
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  7697
    |myClass inst
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  7698
     numInst "{ Class: SmallInteger }" |
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  7699
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  7700
    myClass := self class.
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  7701
    "check the instance variables"
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  7702
    numInst := myClass instSize.
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  7703
    1 to:numInst do:[:i | 
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  7704
        inst := self instVarAt:i.
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  7705
        (checkBlock value:inst) ifTrue:[actionBlock value:inst].
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  7706
    ].
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  7707
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  7708
    "check the indexed variables"
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  7709
    myClass isVariable ifTrue:[
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  7710
        myClass isPointers ifTrue:[
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  7711
            "no need to search in non pointer fields"
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  7712
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  7713
            numInst := self basicSize.
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  7714
            1 to:numInst do:[:i | 
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  7715
                inst := self basicAt:i.
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  7716
                (checkBlock value:inst) ifTrue:[actionBlock value:inst].
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  7717
            ]
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  7718
        ]
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  7719
    ].
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  7720
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  7721
    "
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  7722
     (1 @ 3.4) referencesForWhich:[:i | i isFloat] do:[:i | Transcript showCR:i]  
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  7723
    "
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  7724
!
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  7725
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7726
referencesInstanceOf:aClass
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7727
    "return true, if the receiver refers to an instance of
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7728
     the argument, aClass.This method exists
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7729
     to support searching for users of a class."
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
    |myClass 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7732
     numInst "{ Class: SmallInteger }" |
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7733
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7734
    myClass := self class.
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
    "check the class"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7737
    (myClass isMemberOf:aClass) ifTrue:[^ true].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7738
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7739
    "check the instance variables"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7740
    numInst := myClass instSize.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7741
    1 to:numInst do:[:i | 
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7742
        ((self instVarAt:i) isMemberOf:aClass) ifTrue:[^ true]
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7743
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7744
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7745
    "check the indexed variables"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7746
    myClass isVariable ifTrue:[
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7747
        myClass isPointers ifFalse:[
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7748
            "no need to search in non-pointer indexed fields"
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7749
            myClass isLongs ifTrue:[
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7750
                (aClass == SmallInteger or:[aClass == LargeInteger]) ifFalse:[^ false].
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7751
            ] ifFalse:[
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7752
                myClass isFloatsOrDoubles ifTrue:[^ aClass == Float].
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7753
                ^ aClass == SmallInteger
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7754
            ]
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7755
        ].
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7756
        numInst := self basicSize.
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7757
        1 to:numInst do:[:i | 
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7758
            ((self basicAt:i) isMemberOf:aClass) ifTrue:[^ true]
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7759
        ]
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7760
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7761
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7762
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7763
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7764
     (1 @ 3.4) referencesInstanceOf:Float     
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7765
     (1 @ 3.4) referencesInstanceOf:Fraction    
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7766
     View new initialize referencesInstanceOf:(Display class)  
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7767
    "
6074
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7768
!
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7769
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7770
referencesObject:anObject
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7771
    "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
  7772
     - for debugging only"
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7773
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7774
%{  /* NOCONTEXT */
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7775
    OBJ cls, flags;
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7776
    int nInsts, i;
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7777
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7778
    if (! __isNonNilObject(self)) {
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7779
        RETURN (false);
6074
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7780
    }
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7781
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7782
    /*
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7783
     * 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
  7784
     * 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
  7785
     * 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
  7786
     */
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7787
    if (__isNonNilObject(anObject)) {
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7788
        if ((__qSpace(self) <= OLDSPACE) && !__isRemembered(self)) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7789
            int spc;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7790
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7791
            if (((spc = __qSpace(anObject)) == NEWSPACE) || (spc == SURVSPACE)) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7792
                RETURN (false);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7793
            }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7794
        }
6074
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7795
    }
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7796
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7797
    cls = __qClass(self);
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7798
    if (cls == anObject) {
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7799
        RETURN (true);
6074
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7800
    }
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7801
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7802
    flags = __ClassInstPtr(cls)->c_flags;
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7803
    if (((INT)flags & __MASKSMALLINT(ARRAYMASK)) == __MASKSMALLINT(POINTERARRAY)) {
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7804
        nInsts = __BYTES2OBJS__(__qSize(self) - OHDR_SIZE);
6074
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7805
    } else {
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7806
        nInsts = __intVal(__ClassInstPtr(cls)->c_ninstvars);
6074
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7807
    }
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7808
    if (! nInsts) {
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7809
        RETURN (false);
6074
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7810
    }
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7811
#if defined(memsrch4)
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7812
    if (memsrch4(__InstPtr(self)->i_instvars, (INT)anObject, nInsts)) {
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7813
        RETURN (true);
6074
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7814
    }
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7815
#else
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7816
    for (i=0; i<nInsts; i++) {
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7817
        if (__InstPtr(self)->i_instvars[i] == anObject) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7818
            RETURN (true);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7819
        }
6074
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7820
    }
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7821
#endif /* memsrch4 */
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7822
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7823
%}.
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7824
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7825
"/    |myClass 
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7826
"/     numInst "{ Class: SmallInteger }" |
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7827
"/
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7828
"/    myClass := self class.
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7829
"/
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7830
"/    "check the class"
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7831
"/    (myClass == anObject) ifTrue:[^ true].
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7832
"/
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7833
"/    "check the instance variables"
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7834
"/    numInst := myClass instSize.
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7835
"/    1 to:numInst do:[:i | 
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7836
"/      ((self instVarAt:i) == anObject) ifTrue:[^ true]
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7837
"/    ].
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7838
"/
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7839
"/    "check the indexed variables"
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7840
"/    myClass isVariable ifTrue:[
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7841
"/      myClass isPointers ifFalse:[
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7842
"/          "/
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7843
"/          "/ 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
  7844
"/          "/ 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
  7845
"/          "/ 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
  7846
"/          "/ 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
  7847
"/          "/ 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
  7848
"/          "/ 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
  7849
"/          "/ 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
  7850
"/
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7851
"/          ^ false.
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7852
"/
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7853
"/          "/ alternative:
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7854
"/          "/  anObject isNumber ifFalse:[^ false].
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7855
"/      ].
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7856
"/
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7857
"/      "/
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7858
"/      "/ 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
  7859
"/      "/ idenitytIndex method, use it
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7860
"/      "/
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7861
"/      myClass == Array ifTrue:[
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7862
"/          ^ (self identityIndexOf:anObject) ~~ 0
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7863
"/      ].
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7864
"/
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7865
"/      "/
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7866
"/      "/ otherwise, do it the slow way
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7867
"/      "/
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7868
"/      numInst := self basicSize.
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7869
"/      1 to:numInst do:[:i | 
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7870
"/          ((self basicAt:i) == anObject) ifTrue:[^ true]
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7871
"/      ]
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7872
"/    ].
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7873
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7874
    ^ false
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7875
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7876
    "
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7877
     |v|
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7878
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7879
     v := View new initialize.
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7880
     v references:Display. 
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7881
    "
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7882
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7883
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7884
!Object methodsFor:'synchronized evaluation'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7885
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7886
freeSynchronizationSemaphore    
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7887
    "free synchronizationSemaphore. May be used, to save memory when
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7888
     an object is no longer used synchronized."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7889
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7890
    |sema|
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
    sema := self synchronizationSemaphore.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7893
    sema notNil ifTrue:[
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7894
        sema wait.              "/ get lock
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7895
        self synchronizationSemaphore:nil.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7896
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7897
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
     self synchronized:[].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7900
     self synchronizationSemaphore.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7901
     self freeSynchronizationSemaphore.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7902
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7903
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7904
    "Created: 28.1.1997 / 19:31:20 / stefan"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7905
    "Modified: 28.1.1997 / 19:47:55 / stefan"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7906
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7907
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7908
synchronizationSemaphore
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7909
    "return the synchronization semaphore for myself.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7910
     subclasses may redefine"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7911
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7912
    ^ SynchronizationSemaphores at:self ifAbsent:[].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7913
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
      self synchronizationSemaphore
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7916
    "
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
    "Modified: 28.1.1997 / 19:47:09 / stefan"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7919
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7920
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7921
synchronizationSemaphore:aSemaphore
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7922
    "set the synchronisationSemaphore for myself.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7923
     subclasses may redefine this method"
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
    aSemaphore isNil ifTrue:[
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7926
        "/ remove Semaphore
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7927
        SynchronizationSemaphores removeKey:self ifAbsent:nil.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7928
    ] ifFalse:[
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  7929
        SynchronizationSemaphores at:self put:aSemaphore.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7930
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7931
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7932
    "Modified: 28.1.1997 / 19:37:48 / stefan"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7933
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7934
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7935
synchronized:aBlock
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7936
    "evaluate aBlock synchronized, i.e. use a monitor for this object"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7937
6600
9c85adf293dd Simplify #synchronized:
Stefan Vogel <sv@exept.de>
parents: 6572
diff changeset
  7938
    |sema wasBlocked|
9c85adf293dd Simplify #synchronized:
Stefan Vogel <sv@exept.de>
parents: 6572
diff changeset
  7939
9c85adf293dd Simplify #synchronized:
Stefan Vogel <sv@exept.de>
parents: 6572
diff changeset
  7940
    wasBlocked := OperatingSystem blockInterrupts.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7941
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7942
    sema := self synchronizationSemaphore.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7943
    sema isNil ifTrue:[
8481
d12d202b6ddb Set name of synchronization sema
Stefan Vogel <sv@exept.de>
parents: 8441
diff changeset
  7944
        sema := RecursionLock new name:self className.
6600
9c85adf293dd Simplify #synchronized:
Stefan Vogel <sv@exept.de>
parents: 6572
diff changeset
  7945
        self synchronizationSemaphore:sema.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7946
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7947
6600
9c85adf293dd Simplify #synchronized:
Stefan Vogel <sv@exept.de>
parents: 6572
diff changeset
  7948
    wasBlocked ifFalse:[OperatingSystem unblockInterrupts].
7211
87f5d25b5c3d Make synchronizationSemaphore a recursionLock
Stefan Vogel <sv@exept.de>
parents: 7208
diff changeset
  7949
    sema critical:aBlock.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7950
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7951
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7952
       [Object synchronized:[Delay waitForSeconds:2. Transcript showCR:'1']] fork.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7953
       [Object synchronized:[Delay waitForSeconds:2. Transcript showCR:'2']] fork.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7954
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7955
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7956
    "Created: 28.1.1997 / 17:52:56 / stefan"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7957
    "Modified: 30.1.1997 / 13:38:54 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7958
    "Modified: 20.2.1997 / 09:43:35 / stefan"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7959
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7960
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7961
!Object methodsFor:'system primitives'!
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
asOop
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7964
    "ST-80 compatibility:
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7965
     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
  7966
     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
  7967
     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
  7968
     key, which provides (at least) some identity indication.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7969
     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
  7970
     key of two non-identical objects may be the same.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7971
     You'd better not use it - especially do not misuse it."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7972
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7973
    ^ self identityHash
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7974
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7975
    "Created: 9.11.1996 / 19:09:56 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7976
    "Modified: 9.11.1996 / 19:16:04 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7977
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7978
8939
ac97eb450b97 Fix examples in #perform:*ifNotUnderstood:
Stefan Vogel <sv@exept.de>
parents: 8935
diff changeset
  7979
beImmutable
ac97eb450b97 Fix examples in #perform:*ifNotUnderstood:
Stefan Vogel <sv@exept.de>
parents: 8935
diff changeset
  7980
    "experimental - not yet usable; do not use"
ac97eb450b97 Fix examples in #perform:*ifNotUnderstood:
Stefan Vogel <sv@exept.de>
parents: 8935
diff changeset
  7981
ac97eb450b97 Fix examples in #perform:*ifNotUnderstood:
Stefan Vogel <sv@exept.de>
parents: 8935
diff changeset
  7982
%{  /* NOCONTEXT */
ac97eb450b97 Fix examples in #perform:*ifNotUnderstood:
Stefan Vogel <sv@exept.de>
parents: 8935
diff changeset
  7983
    if (! __isNonNilObject(self)) {
ac97eb450b97 Fix examples in #perform:*ifNotUnderstood:
Stefan Vogel <sv@exept.de>
parents: 8935
diff changeset
  7984
        RETURN (self);
ac97eb450b97 Fix examples in #perform:*ifNotUnderstood:
Stefan Vogel <sv@exept.de>
parents: 8935
diff changeset
  7985
    }
ac97eb450b97 Fix examples in #perform:*ifNotUnderstood:
Stefan Vogel <sv@exept.de>
parents: 8935
diff changeset
  7986
    __beImmutable(self);
ac97eb450b97 Fix examples in #perform:*ifNotUnderstood:
Stefan Vogel <sv@exept.de>
parents: 8935
diff changeset
  7987
%}
ac97eb450b97 Fix examples in #perform:*ifNotUnderstood:
Stefan Vogel <sv@exept.de>
parents: 8935
diff changeset
  7988
!
ac97eb450b97 Fix examples in #perform:*ifNotUnderstood:
Stefan Vogel <sv@exept.de>
parents: 8935
diff changeset
  7989
ac97eb450b97 Fix examples in #perform:*ifNotUnderstood:
Stefan Vogel <sv@exept.de>
parents: 8935
diff changeset
  7990
beMutable
ac97eb450b97 Fix examples in #perform:*ifNotUnderstood:
Stefan Vogel <sv@exept.de>
parents: 8935
diff changeset
  7991
    "experimental - not yet usable; do not use"
ac97eb450b97 Fix examples in #perform:*ifNotUnderstood:
Stefan Vogel <sv@exept.de>
parents: 8935
diff changeset
  7992
ac97eb450b97 Fix examples in #perform:*ifNotUnderstood:
Stefan Vogel <sv@exept.de>
parents: 8935
diff changeset
  7993
%{  /* NOCONTEXT */
ac97eb450b97 Fix examples in #perform:*ifNotUnderstood:
Stefan Vogel <sv@exept.de>
parents: 8935
diff changeset
  7994
    if (! __isNonNilObject(self)) {
ac97eb450b97 Fix examples in #perform:*ifNotUnderstood:
Stefan Vogel <sv@exept.de>
parents: 8935
diff changeset
  7995
        RETURN (self);
ac97eb450b97 Fix examples in #perform:*ifNotUnderstood:
Stefan Vogel <sv@exept.de>
parents: 8935
diff changeset
  7996
    }
ac97eb450b97 Fix examples in #perform:*ifNotUnderstood:
Stefan Vogel <sv@exept.de>
parents: 8935
diff changeset
  7997
    __beMutable(self);
ac97eb450b97 Fix examples in #perform:*ifNotUnderstood:
Stefan Vogel <sv@exept.de>
parents: 8935
diff changeset
  7998
%}
ac97eb450b97 Fix examples in #perform:*ifNotUnderstood:
Stefan Vogel <sv@exept.de>
parents: 8935
diff changeset
  7999
!
ac97eb450b97 Fix examples in #perform:*ifNotUnderstood:
Stefan Vogel <sv@exept.de>
parents: 8935
diff changeset
  8000
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8001
become:anotherObject
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8002
    "make all references to the receiver become references to anotherObject
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8003
     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
  8004
     This can be a very dangerous operation - be warned.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8005
     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
  8006
     produce many strange effects (think of hashing in Sets, Dictionaries etc.).
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
     This may also be an expensive (i.e. slow) operation, 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8009
     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
  8010
     references to the two objects (although the primitive tries hard to
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8011
     limit the search, for acceptable performance in most cases). 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8012
     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
  8013
     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
  8014
     returned).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8015
     (notice that #become: is not used heavily by the system 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8016
      - the Collection-classes have been rewritten to not use it.)"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8017
%{
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8018
    if (__primBecome(self, anotherObject)) {
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  8019
        RETURN ( self );
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8020
    }
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8021
%}.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8022
    self primitiveFailed
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8023
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8024
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8025
becomeNil
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8026
    "make all references to the receiver become nil - effectively getting
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8027
     rid of the receiver. 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8028
     This can be a very dangerous operation - be warned.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8029
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8030
     This may be an expensive (i.e. slow) operation.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8031
     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
  8032
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8033
%{
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8034
    if (__primBecomeNil(self)) {
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  8035
        RETURN ( nil );
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8036
    }
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8037
%}.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8038
    self primitiveFailed
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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8041
becomeSameAs:anotherObject
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8042
    "make all references to the receiver become references to anotherObject
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8043
     but NOT vice versa (as done in #become:).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8044
     This can be a very dangerous operation - be warned.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8045
     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
  8046
     produce many strange effects (think of hashing in Sets, Dictionaries etc.).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8047
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8048
     This may also be an expensive (i.e. slow) operation,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8049
     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
  8050
     references to the two objects (although the primitive tries hard to
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8051
     limit the search, for acceptable performance in most cases).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8052
     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
  8053
     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
  8054
%{
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8055
    if (__primBecomeSameAs(self, anotherObject)) {
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  8056
        RETURN ( self );
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8057
    }
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8058
%}.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8059
    self primitiveFailed
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8060
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8061
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8062
changeClassTo:otherClass
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8063
    "changes the class of the receiver to the argument, otherClass.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8064
     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
  8065
     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
  8066
     type of indexed instance variables). 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8067
     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
  8068
     is UndefinedObject or a Smallinteger, a primitive error is triggered."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8069
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8070
    |myClass ok|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8071
9405
cdeae08708cd comments
Stefan Vogel <sv@exept.de>
parents: 9375
diff changeset
  8072
    otherClass autoload.
cdeae08708cd comments
Stefan Vogel <sv@exept.de>
parents: 9375
diff changeset
  8073
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8074
    "check for UndefinedObject/SmallInteger receiver or newClass"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8075
%{
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8076
    {
6533
8396a7332890 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6517
diff changeset
  8077
        OBJ other = otherClass;
8396a7332890 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6517
diff changeset
  8078
8396a7332890 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6517
diff changeset
  8079
        if (__isNonNilObject(self) 
8396a7332890 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6517
diff changeset
  8080
         && __isNonNilObject(other)
8396a7332890 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6517
diff changeset
  8081
         && (other != UndefinedObject)
8396a7332890 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6517
diff changeset
  8082
         && (other != SmallInteger)) {
8396a7332890 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6517
diff changeset
  8083
            ok = true;
8396a7332890 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6517
diff changeset
  8084
        } else {
8396a7332890 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6517
diff changeset
  8085
            ok = false;
8396a7332890 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6517
diff changeset
  8086
        }
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8087
    }
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8088
%}.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8089
    ok ifTrue:[
6533
8396a7332890 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6517
diff changeset
  8090
        ok := false.
8396a7332890 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6517
diff changeset
  8091
        myClass := self class.
8396a7332890 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6517
diff changeset
  8092
        myClass flags == otherClass flags ifTrue:[
8396a7332890 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6517
diff changeset
  8093
            myClass instSize == otherClass instSize ifTrue:[
8396a7332890 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6517
diff changeset
  8094
                "same instance layout and types: its ok to do it"
8396a7332890 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6517
diff changeset
  8095
                ok := true.
8396a7332890 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6517
diff changeset
  8096
            ] ifFalse:[
8396a7332890 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6517
diff changeset
  8097
                myClass isPointers ifTrue:[
8396a7332890 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6517
diff changeset
  8098
                    myClass isVariable ifTrue:[
8396a7332890 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6517
diff changeset
  8099
                        ok := true
8396a7332890 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6517
diff changeset
  8100
                    ]
8396a7332890 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6517
diff changeset
  8101
                ]
8396a7332890 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6517
diff changeset
  8102
            ]
8396a7332890 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6517
diff changeset
  8103
        ] ifFalse:[
8396a7332890 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6517
diff changeset
  8104
            myClass isPointers ifTrue:[
8396a7332890 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6517
diff changeset
  8105
                "if newClass is a variable class, with instSize <= my instsize,
8396a7332890 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6517
diff changeset
  8106
                 we can do it (effectively mapping additional instvars into the
8396a7332890 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6517
diff changeset
  8107
                 variable part) - usefulness is questionable, though"
8396a7332890 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6517
diff changeset
  8108
8396a7332890 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6517
diff changeset
  8109
                otherClass isPointers ifTrue:[
8396a7332890 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6517
diff changeset
  8110
                    otherClass isVariable ifTrue:[
8396a7332890 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6517
diff changeset
  8111
                        otherClass instSize <= (myClass instSize + self basicSize) 
8396a7332890 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6517
diff changeset
  8112
                        ifTrue:[
8396a7332890 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6517
diff changeset
  8113
                            ok := true
8396a7332890 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6517
diff changeset
  8114
                        ]
8396a7332890 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6517
diff changeset
  8115
                    ] ifFalse:[
8396a7332890 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6517
diff changeset
  8116
                        otherClass instSize == (myClass instSize + self basicSize) 
8396a7332890 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6517
diff changeset
  8117
                        ifTrue:[
8396a7332890 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6517
diff changeset
  8118
                            ok := true
8396a7332890 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6517
diff changeset
  8119
                        ]
8396a7332890 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6517
diff changeset
  8120
                    ]
8396a7332890 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6517
diff changeset
  8121
                ] ifFalse:[
8396a7332890 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6517
diff changeset
  8122
                    "it does not make sense to convert pointers to bytes ..."
8396a7332890 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6517
diff changeset
  8123
                ]
8396a7332890 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6517
diff changeset
  8124
            ] ifFalse:[
8396a7332890 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6517
diff changeset
  8125
                "does it make sense, to convert bits ?"
8396a7332890 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6517
diff changeset
  8126
                "could allow byteArray->wordArray->longArray->floatArray->doubleArray here ..."
8396a7332890 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6517
diff changeset
  8127
                (myClass isBitsExtended and:[otherClass isBitsExtended]) ifTrue:[
8396a7332890 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6517
diff changeset
  8128
                    ok := true
8396a7332890 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6517
diff changeset
  8129
                ]
8396a7332890 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6517
diff changeset
  8130
            ]
8396a7332890 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6517
diff changeset
  8131
        ]
5755
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
    ok ifTrue:[
6533
8396a7332890 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6517
diff changeset
  8134
        "now, change the receivers class ..."
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8135
%{
6533
8396a7332890 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6517
diff changeset
  8136
        {
8396a7332890 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6517
diff changeset
  8137
            OBJ me = self;
8396a7332890 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6517
diff changeset
  8138
8396a7332890 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6517
diff changeset
  8139
            __qClass(me) = otherClass;
8396a7332890 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6517
diff changeset
  8140
            __STORE(me, otherClass);
8396a7332890 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6517
diff changeset
  8141
            RETURN (me);
8396a7332890 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6517
diff changeset
  8142
        }
5755
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
    ].
9405
cdeae08708cd comments
Stefan Vogel <sv@exept.de>
parents: 9375
diff changeset
  8145
5755
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
     the receiver cannot be represented as a instance of
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8148
     the desired class.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8149
     For example, you cannot change a bitInstance (byteArray etc.) 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8150
     into a pointer object and vice versa.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8151
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8152
    self primitiveFailed
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8153
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8154
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8155
changeClassToThatOf:anObject
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8156
    "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
  8157
     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
  8158
     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
  8159
     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
  8160
     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
  8161
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8162
    self changeClassTo:(anObject class)
6033
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  8163
!
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  8164
8935
f770c55ba40e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8934
diff changeset
  8165
isImmutable
f770c55ba40e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8934
diff changeset
  8166
    "experimental - not yet usable; do not use"
f770c55ba40e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8934
diff changeset
  8167
f770c55ba40e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8934
diff changeset
  8168
%{  /* NOCONTEXT */
f770c55ba40e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8934
diff changeset
  8169
    if (! __isNonNilObject(self)) {
f770c55ba40e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8934
diff changeset
  8170
        RETURN (true);
f770c55ba40e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8934
diff changeset
  8171
    }
f770c55ba40e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8934
diff changeset
  8172
    RETURN (__isImmutable(self) ? true : false);
f770c55ba40e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8934
diff changeset
  8173
%}
f770c55ba40e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8934
diff changeset
  8174
!
f770c55ba40e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8934
diff changeset
  8175
6033
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  8176
replaceReferencesTo:anObject with:newRef
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  8177
    "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
  8178
     Return true, if any reference was changed.
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  8179
     Notice: this does not change the class-reference."
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  8180
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  8181
%{  /* NOCONTEXT */
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  8182
    OBJ cls, flags, anyChange;
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  8183
    int nInsts, i;
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  8184
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  8185
    if (! __isNonNilObject(self)) {
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  8186
        RETURN (false);
6033
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  8187
    }
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  8188
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  8189
    /*
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  8190
     * a little optimization: use the fact that all old objects
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  8191
     * 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
  8192
     * a trivial reject is possible, if anObject is a newbee
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  8193
     */
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  8194
    if (__isNonNilObject(anObject)) {
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  8195
        if ((__qSpace(self) <= OLDSPACE) && !__isRemembered(self)) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  8196
            int spc;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  8197
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  8198
            if (((spc = __qSpace(anObject)) == NEWSPACE) || (spc == SURVSPACE)) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  8199
                RETURN (false);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  8200
            }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  8201
        }
6033
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  8202
    }
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  8203
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  8204
    cls = __qClass(self);
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  8205
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  8206
    flags = __ClassInstPtr(cls)->c_flags;
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  8207
    if (((INT)flags & __MASKSMALLINT(ARRAYMASK)) == __MASKSMALLINT(POINTERARRAY)) {
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  8208
        nInsts = __BYTES2OBJS__(__qSize(self) - OHDR_SIZE);
6033
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  8209
    } else {
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  8210
        nInsts = __intVal(__ClassInstPtr(cls)->c_ninstvars);
6033
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  8211
    }
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  8212
    if (! nInsts) {
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  8213
        RETURN (false);
6033
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  8214
    }
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  8215
    anyChange = false;
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  8216
    for (i=0; i<nInsts; i++) {
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  8217
        if (__InstPtr(self)->i_instvars[i] == anObject) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  8218
            __InstPtr(self)->i_instvars[i] = newRef;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  8219
            __STORE(self, newRef);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  8220
            anyChange = true;
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  8221
        }
6033
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  8222
    }
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  8223
    RETURN (anyChange);
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  8224
%}.
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  8225
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  8226
    "
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  8227
     |v|
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  8228
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  8229
     v := Array with:1234 with:'hello' with:Array.
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  8230
     v replaceReferencesTo:Array with:ByteArray.
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  8231
     v inspect
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  8232
    "
5755
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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8235
!Object methodsFor:'testing'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8236
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8237
? defaultValue
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8238
     "a syntactic shugar-piece:
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8239
      if the receiver is nil, return the defaultValue;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8240
      otherwise, return the receiver.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8241
      This method is only redefined in UndefinedObject - therefore,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8242
      the recevier is retuned here.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8243
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8244
      Thus, if foo and bar are simple variables or constants,
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  8245
          foo ? bar
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8246
      is the same as:
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  8247
          (foo isNil ifTrue:[bar] ifFalse:[foo])
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8248
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8249
      if they are message sends, the equivalent code is:
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  8250
          [
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  8251
              |t1 t2|
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  8252
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  8253
              t1 := foo.
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  8254
              t2 := bar.
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  8255
              t1 isNil ifTrue:[t2] ifFalse:[t1]
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  8256
          ] value
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8257
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8258
      Can be used to provide defaultValues to variables,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8259
      as in:
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  8260
          foo := arg ? #defaultValue
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8261
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8262
      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
  8263
      Notice:
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  8264
         This method is open coded (inlined) by the compiler(s)
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  8265
         - redefining it may not work as expected."
5755
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
    ^ self
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
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8270
     1 ? #default
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8271
     nil ? #default
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8272
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8273
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8274
    "Created: / 4.11.1996 / 20:36:19 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8275
    "Modified: / 19.5.1998 / 17:39:56 / cg"
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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8278
?? defaultValue
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8279
     "a syntactic shugar-piece:
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8280
      much like ?, but sends #value to the argument if required.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8281
      (i.e. its the same as #ifNil:)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8282
      If the receiver is nil, return the defaultValues value;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8283
      otherwise, return the receiver.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8284
      This method is only redefined in UndefinedObject - therefore,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8285
      the recevier is retuned here.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8286
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8287
      Thus, if foo and bar are simple variables or constants,
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  8288
          foo ?? bar
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8289
      is the same as:
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  8290
          (foo isNil ifTrue:[bar value] ifFalse:[foo])
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8291
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8292
      if they are message sends, the equivalent code is:
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  8293
          [
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  8294
              |t t2|
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  8295
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  8296
              t := foo.
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  8297
              t isNil ifTrue:[bar value] ifFalse:[t]
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  8298
          ] value
5755
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
      Can be used to provide defaultValues to variables,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8301
      as in:
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  8302
          foo := arg ?? [ self computeDefault ]
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8303
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8304
      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
  8305
     "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8306
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8307
    ^ self
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
     1 ?? #default 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8311
     nil ?? #default
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8312
     1 ?? [ self halt. 1 + 2 ] 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8313
     nil ?? [ self halt. 1 + 2 ] 
6069
9aff12a37f5e comment
Claus Gittinger <cg@exept.de>
parents: 6068
diff changeset
  8314
     1 ?? [Date today]   
9aff12a37f5e comment
Claus Gittinger <cg@exept.de>
parents: 6068
diff changeset
  8315
     nil ?? [Date today]  
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8316
    "
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
    "Created: / 4.11.1996 / 20:36:19 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8319
    "Modified: / 19.5.1998 / 17:42:56 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8320
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8321
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8322
ifNil:aBlockOrValue
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8323
    "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
  8324
     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
  8325
     receiver.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8326
     Notice:
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  8327
        This method is open coded (inlined) by the compiler(s)
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  8328
        - redefining it may not work as expected."
5755
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
    ^ self
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8331
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8332
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8333
ifNil:nilBlockOrValue ifNotNil:notNilBlockOrValue
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8334
    "return the value of the first arg, if I am nil,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8335
     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
  8336
     Notice:
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  8337
        This method is open coded (inlined) by the compiler(s)
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  8338
        - redefining it may not work as expected."
5755
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
    ^ notNilBlockOrValue value
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8341
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8342
!
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
ifNotNil:aBlockOrValue
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8345
    "return myself if nil, or the result from evaluating the argument, 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8346
     if I am not nil.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8347
     Notice:
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  8348
        This method is open coded (inlined) by the compiler(s)
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  8349
        - redefining it may not work as expected."
5755
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
    ^ aBlockOrValue value
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8352
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8353
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8354
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8355
ifNotNil:notNilBlockOrValue ifNil:nilBlockOrValue
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8356
    "return the value of the 2nd arg, if I am nil,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8357
     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
  8358
     Notice:
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  8359
        This method is open coded (inlined) by the compiler(s)
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  8360
        - redefining it may not work as expected."
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
    ^ notNilBlockOrValue value
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
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8366
8574
33bb637901eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8563
diff changeset
  8367
ifNotNilDo:aBlock
33bb637901eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8563
diff changeset
  8368
    "if the reciever is non-nil, return the value of aBlock, passing myself as argument.
33bb637901eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8563
diff changeset
  8369
     Otherwise do nothing and return nil."
33bb637901eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8563
diff changeset
  8370
33bb637901eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8563
diff changeset
  8371
    ^ aBlock value:self
33bb637901eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8563
diff changeset
  8372
!
33bb637901eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8563
diff changeset
  8373
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8374
isArray
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8375
    "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
  8376
     false is returned here - the method is only redefined in Array."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8377
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8378
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8379
!
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
isAssociation
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8382
    "return true, if the receiver is some kind of association;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8383
     false is returned here - the method is only redefined in Association."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8384
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8385
    ^ false
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
    "Created: 14.5.1996 / 17:03:45 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8388
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8389
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8390
isBehavior
9221
d8fff4a78065 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9216
diff changeset
  8391
    "return true, if the receiver is describing another objects behavior.
d8fff4a78065 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9216
diff changeset
  8392
     False is returned here - the method is only redefined in Behavior."
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8393
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8394
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8395
!
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
isBlock
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8398
    "return true, if the receiver is some kind of block;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8399
     false returned here - the method is only redefined in Block."
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
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8402
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8403
5824
fdf9cd50a141 Added method isBoolean; need this!
martin
parents: 5821
diff changeset
  8404
isBoolean
fdf9cd50a141 Added method isBoolean; need this!
martin
parents: 5821
diff changeset
  8405
    "return true, if the receiver is a boolean;
fdf9cd50a141 Added method isBoolean; need this!
martin
parents: 5821
diff changeset
  8406
     false is returned here - the method is only redefined in Boolean."
fdf9cd50a141 Added method isBoolean; need this!
martin
parents: 5821
diff changeset
  8407
fdf9cd50a141 Added method isBoolean; need this!
martin
parents: 5821
diff changeset
  8408
    ^ false
fdf9cd50a141 Added method isBoolean; need this!
martin
parents: 5821
diff changeset
  8409
!
fdf9cd50a141 Added method isBoolean; need this!
martin
parents: 5821
diff changeset
  8410
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8411
isByteArray
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8412
    "return true, if the receiver is some kind of bytearray;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8413
     false is returned here - the method is only redefined in ByteArray."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8414
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8415
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8416
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8417
8986
c2962d45eca0 new: #isByteCollection
Stefan Vogel <sv@exept.de>
parents: 8977
diff changeset
  8418
isByteCollection
c2962d45eca0 new: #isByteCollection
Stefan Vogel <sv@exept.de>
parents: 8977
diff changeset
  8419
    "return true, if the receiver is some kind of byte collection,
c2962d45eca0 new: #isByteCollection
Stefan Vogel <sv@exept.de>
parents: 8977
diff changeset
  8420
     i.e. #at: and #at:put: accesses a byte. This is different from 'self class isBytes', 
c2962d45eca0 new: #isByteCollection
Stefan Vogel <sv@exept.de>
parents: 8977
diff changeset
  8421
     since e.g. in BitArray single bits are accessed, but it is implemented as variableBytes class.
c2962d45eca0 new: #isByteCollection
Stefan Vogel <sv@exept.de>
parents: 8977
diff changeset
  8422
    
c2962d45eca0 new: #isByteCollection
Stefan Vogel <sv@exept.de>
parents: 8977
diff changeset
  8423
     false is returned here - the method is only redefined in UninterpretedBytes."
c2962d45eca0 new: #isByteCollection
Stefan Vogel <sv@exept.de>
parents: 8977
diff changeset
  8424
c2962d45eca0 new: #isByteCollection
Stefan Vogel <sv@exept.de>
parents: 8977
diff changeset
  8425
    ^ false
c2962d45eca0 new: #isByteCollection
Stefan Vogel <sv@exept.de>
parents: 8977
diff changeset
  8426
!
c2962d45eca0 new: #isByteCollection
Stefan Vogel <sv@exept.de>
parents: 8977
diff changeset
  8427
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8428
isCharacter
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8429
    "return true, if the receiver is some kind of character;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8430
     false is returned here - the method is only redefined in Character."
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
    ^ false
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
isClass
9405
cdeae08708cd comments
Stefan Vogel <sv@exept.de>
parents: 9375
diff changeset
  8436
    "return true, if the receiver is some kind of class
cdeae08708cd comments
Stefan Vogel <sv@exept.de>
parents: 9375
diff changeset
  8437
     (real class, not just behavior);
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8438
     false is returned here - the method is only redefined in Class."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8439
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8440
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8441
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8442
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8443
isCollection
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8444
    "return true, if the receiver is some kind of collection;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8445
     false is returned here - the method is only redefined in Collection."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8446
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8447
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8448
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8449
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8450
isColor
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8451
    "return true, if the receiver is some kind of color;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8452
     false is returned here - the method is only redefined in Color."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8453
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8454
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8455
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8456
6567
cba5c3103600 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6549
diff changeset
  8457
isCons
cba5c3103600 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6549
diff changeset
  8458
    "return true, if the receiver is a cons (pair);
cba5c3103600 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6549
diff changeset
  8459
     false is returned here - the method is only redefined in Cons."
cba5c3103600 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6549
diff changeset
  8460
cba5c3103600 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6549
diff changeset
  8461
    ^ false
cba5c3103600 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6549
diff changeset
  8462
!
cba5c3103600 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6549
diff changeset
  8463
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8464
isContext
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8465
    "return true, if the receiver is some kind of context;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8466
     false returned here - the method is only redefined in Context."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8467
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8468
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8469
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8470
6181
5876cc789e41 + isEmptyOrNil
Claus Gittinger <cg@exept.de>
parents: 6175
diff changeset
  8471
isEmptyOrNil
8833
717b01292d0e comments
Stefan Vogel <sv@exept.de>
parents: 8832
diff changeset
  8472
    "return true if I am nil or an empty collection - return false here.
717b01292d0e comments
Stefan Vogel <sv@exept.de>
parents: 8832
diff changeset
  8473
     (from Squeak)"
6181
5876cc789e41 + isEmptyOrNil
Claus Gittinger <cg@exept.de>
parents: 6175
diff changeset
  8474
5876cc789e41 + isEmptyOrNil
Claus Gittinger <cg@exept.de>
parents: 6175
diff changeset
  8475
    ^ false
5876cc789e41 + isEmptyOrNil
Claus Gittinger <cg@exept.de>
parents: 6175
diff changeset
  8476
5876cc789e41 + isEmptyOrNil
Claus Gittinger <cg@exept.de>
parents: 6175
diff changeset
  8477
    "Created: / 13.11.2001 / 13:17:04 / cg"
6182
2b992cf865bc comment
Claus Gittinger <cg@exept.de>
parents: 6181
diff changeset
  8478
    "Modified: / 13.11.2001 / 13:28:40 / cg"
6181
5876cc789e41 + isEmptyOrNil
Claus Gittinger <cg@exept.de>
parents: 6175
diff changeset
  8479
!
5876cc789e41 + isEmptyOrNil
Claus Gittinger <cg@exept.de>
parents: 6175
diff changeset
  8480
6221
404495587300 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6203
diff changeset
  8481
isException
6631
5ffa1ce7b2cc #isExceptionCreator instead of #isSignal
Stefan Vogel <sv@exept.de>
parents: 6600
diff changeset
  8482
    "answer true, if this ia an Exception, that may be queried about its type"
5ffa1ce7b2cc #isExceptionCreator instead of #isSignal
Stefan Vogel <sv@exept.de>
parents: 6600
diff changeset
  8483
6221
404495587300 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6203
diff changeset
  8484
    ^ false
404495587300 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6203
diff changeset
  8485
404495587300 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6203
diff changeset
  8486
    "Created: / 17.11.2001 / 18:37:44 / cg"
404495587300 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6203
diff changeset
  8487
!
404495587300 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6203
diff changeset
  8488
6631
5ffa1ce7b2cc #isExceptionCreator instead of #isSignal
Stefan Vogel <sv@exept.de>
parents: 6600
diff changeset
  8489
isExceptionCreator
5ffa1ce7b2cc #isExceptionCreator instead of #isSignal
Stefan Vogel <sv@exept.de>
parents: 6600
diff changeset
  8490
    "return true, if the receiver can create exceptions,
5ffa1ce7b2cc #isExceptionCreator instead of #isSignal
Stefan Vogel <sv@exept.de>
parents: 6600
diff changeset
  8491
     this includes #raise, #raiseRequest as well as the behavior of
5ffa1ce7b2cc #isExceptionCreator instead of #isSignal
Stefan Vogel <sv@exept.de>
parents: 6600
diff changeset
  8492
     an exception handler, such as the #accepts: and #handles: messages"
5ffa1ce7b2cc #isExceptionCreator instead of #isSignal
Stefan Vogel <sv@exept.de>
parents: 6600
diff changeset
  8493
5ffa1ce7b2cc #isExceptionCreator instead of #isSignal
Stefan Vogel <sv@exept.de>
parents: 6600
diff changeset
  8494
    ^ false
5ffa1ce7b2cc #isExceptionCreator instead of #isSignal
Stefan Vogel <sv@exept.de>
parents: 6600
diff changeset
  8495
!
5ffa1ce7b2cc #isExceptionCreator instead of #isSignal
Stefan Vogel <sv@exept.de>
parents: 6600
diff changeset
  8496
5ffa1ce7b2cc #isExceptionCreator instead of #isSignal
Stefan Vogel <sv@exept.de>
parents: 6600
diff changeset
  8497
isExceptionHandler
5ffa1ce7b2cc #isExceptionCreator instead of #isSignal
Stefan Vogel <sv@exept.de>
parents: 6600
diff changeset
  8498
    "return true, if the receiver responds to the exception handler protocol,
5ffa1ce7b2cc #isExceptionCreator instead of #isSignal
Stefan Vogel <sv@exept.de>
parents: 6600
diff changeset
  8499
     especially to the #accepts: and #handles: messages"
5ffa1ce7b2cc #isExceptionCreator instead of #isSignal
Stefan Vogel <sv@exept.de>
parents: 6600
diff changeset
  8500
5ffa1ce7b2cc #isExceptionCreator instead of #isSignal
Stefan Vogel <sv@exept.de>
parents: 6600
diff changeset
  8501
    ^ false
5ffa1ce7b2cc #isExceptionCreator instead of #isSignal
Stefan Vogel <sv@exept.de>
parents: 6600
diff changeset
  8502
!
5ffa1ce7b2cc #isExceptionCreator instead of #isSignal
Stefan Vogel <sv@exept.de>
parents: 6600
diff changeset
  8503
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8504
isExternalStream
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8505
    "return true, if the receiver is some kind of externalStream;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8506
     false is returned here - the method is only redefined in ExternalStream."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8507
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8508
    ^false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8509
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8510
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8511
isFileStream
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8512
    "return true, if the receiver is some kind of fileStream;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8513
     false is returned here - the method is only redefined in FileStream."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8514
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8515
    ^false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8516
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8517
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8518
isFilename
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8519
    "return true, if the receiver is some kind of filename;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8520
     false is returned here - the method is only redefined in Filename."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8521
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8522
    ^false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8523
!
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
isFixedPoint
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8526
    "return true, if the receiver is some kind of fixedPoint number;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8527
     false is returned here - the method is only redefined in FixedPoint."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8528
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8529
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8530
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8531
    "Created: 5.11.1996 / 19:23:04 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8532
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8533
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8534
isFixedSize
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8535
    "return true if the receiver cannot grow easily 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8536
     (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
  8537
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8538
    ^ true
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
6185
2029fdbadfde +isFloat
Claus Gittinger <cg@exept.de>
parents: 6182
diff changeset
  8541
isFloat
2029fdbadfde +isFloat
Claus Gittinger <cg@exept.de>
parents: 6182
diff changeset
  8542
    "return true, if the receiver is some kind of floating point number;
2029fdbadfde +isFloat
Claus Gittinger <cg@exept.de>
parents: 6182
diff changeset
  8543
     false is returned here.
2029fdbadfde +isFloat
Claus Gittinger <cg@exept.de>
parents: 6182
diff changeset
  8544
     Same as #isLimitedPrecisionReal, but a better name ;-)"
2029fdbadfde +isFloat
Claus Gittinger <cg@exept.de>
parents: 6182
diff changeset
  8545
2029fdbadfde +isFloat
Claus Gittinger <cg@exept.de>
parents: 6182
diff changeset
  8546
    ^ false
2029fdbadfde +isFloat
Claus Gittinger <cg@exept.de>
parents: 6182
diff changeset
  8547
2029fdbadfde +isFloat
Claus Gittinger <cg@exept.de>
parents: 6182
diff changeset
  8548
    "Modified: / 14.11.2001 / 14:57:46 / cg"
2029fdbadfde +isFloat
Claus Gittinger <cg@exept.de>
parents: 6182
diff changeset
  8549
!
2029fdbadfde +isFloat
Claus Gittinger <cg@exept.de>
parents: 6182
diff changeset
  8550
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8551
isForm
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8552
    "return true, if the receiver is some kind of form;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8553
     false is returned here - the method is only redefined in Form."
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
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8556
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8557
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8558
isFraction
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8559
    "return true, if the receiver is some kind of fraction;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8560
     false is returned here - the method is only redefined in Fraction."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8561
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8562
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8563
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8564
9293
307bb63a9057 category change
Claus Gittinger <cg@exept.de>
parents: 9279
diff changeset
  8565
isHierarchicalItem
307bb63a9057 category change
Claus Gittinger <cg@exept.de>
parents: 9279
diff changeset
  8566
    "used to decide if the parent is a hierarchical item or the model"
307bb63a9057 category change
Claus Gittinger <cg@exept.de>
parents: 9279
diff changeset
  8567
307bb63a9057 category change
Claus Gittinger <cg@exept.de>
parents: 9279
diff changeset
  8568
    ^ false
307bb63a9057 category change
Claus Gittinger <cg@exept.de>
parents: 9279
diff changeset
  8569
!
307bb63a9057 category change
Claus Gittinger <cg@exept.de>
parents: 9279
diff changeset
  8570
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8571
isImage
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8572
    "return true, if the receiver is some kind of image;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8573
     false is returned here - the method is only redefined in Image."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8574
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8575
    ^ false
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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8578
isImageOrForm
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8579
    "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
  8580
     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
  8581
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8582
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8583
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8584
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8585
isImmediate
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8586
    "return true if I am an immediate object
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8587
     i.e. I am represented in the pointer itself and
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8588
     no real object header/storage is used me.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8589
     (currently, only SmallIntegers, some characters and nil return true)"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8590
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8591
    ^ self class hasImmediateInstances
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8592
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8593
    "Created: 3.6.1997 / 12:00:18 / cg"
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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8596
isInteger
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8597
    "return true, if the receiver is some kind of integer number;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8598
     false is returned here - the method is only redefined in Integer."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8599
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8600
    ^ false
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
9279
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  8603
isInterestConverter
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  8604
    "return true if I am a kind of interest forwarder"
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  8605
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  8606
    ^ false
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  8607
!
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  8608
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8609
isJavaClass
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8610
    "return true, if this is a javaClass.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8611
     false is returned here - the method is only redefined in JavaClass."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8612
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8613
    ^ false
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
    "Created: / 26.3.1997 / 13:34:54 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8616
    "Modified: / 8.5.1998 / 21:25:21 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8617
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8618
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8619
isJavaClassRef
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8620
    "return true, if this is a JavaClassRef.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8621
     false is returned here - the method is only redefined in JavaClassRef."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8622
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8623
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8624
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8625
    "Modified: / 8.5.1998 / 21:25:46 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8626
    "Created: / 24.12.1999 / 01:46:28 / cg"
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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8629
isJavaContext
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8630
    "return true, if this is a javaContext.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8631
     false is returned here - the method is only redefined in JavaContext."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8632
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8633
    ^ false
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
    "Created: / 8.5.1998 / 21:24:27 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8636
    "Modified: / 8.5.1998 / 21:25:35 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8637
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8638
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8639
isJavaMethod
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8640
    "return true, if this is a JavaMethod.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8641
     false is returned here - the method is only redefined in JavaMethod."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8642
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8643
    ^ false
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
    "Modified: / 8.5.1998 / 21:25:46 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8646
    "Created: / 25.9.1999 / 23:26:12 / 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
isJavaMethodRef
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8650
    "return true, if this is a JavaMethodRef.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8651
     false is returned here - the method is only redefined in JavaMethodRef."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8652
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8653
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8654
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8655
    "Modified: / 8.5.1998 / 21:25:46 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8656
    "Created: / 23.12.1999 / 19:44:51 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8657
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8658
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8659
isJavaObject
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8660
    "return true, if this is a javaObject.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8661
     false is returned here - the method is only redefined in JavaObject."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8662
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8663
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8664
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8665
    "Created: / 26.3.1997 / 13:34:48 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8666
    "Modified: / 8.5.1998 / 21:25:46 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8667
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8668
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8669
isJavaScriptClass
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8670
    "return true, if this is a javaScriptClass.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8671
     false is returned here - the method is only redefined in JavaScriptClass."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8672
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8673
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8674
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8675
8935
f770c55ba40e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8934
diff changeset
  8676
isJavaScriptMetaclass
f770c55ba40e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8934
diff changeset
  8677
    "return true, if this is a javaScript Metaclass.
f770c55ba40e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8934
diff changeset
  8678
     false is returned here - the method is only redefined in JavaScriptMetaclass."
f770c55ba40e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8934
diff changeset
  8679
f770c55ba40e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8934
diff changeset
  8680
    ^ false
f770c55ba40e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8934
diff changeset
  8681
!
f770c55ba40e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8934
diff changeset
  8682
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8683
isKindOf:aClass
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8684
    "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
  8685
     subclasses, false otherwise.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8686
     Advice: 
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  8687
        use of this to check objects for certain attributes/protocoll should
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  8688
        be avoided; it limits the reusability of your classes by limiting use
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  8689
        to instances of certain classes and fences you into a specific inheritance 
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  8690
        hierarchy.
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  8691
        Use check-methods to check an object for a certain attributes/protocol
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  8692
        (such as #isXXXX, #respondsTo: or #isNumber).
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  8693
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  8694
        Using #isKindOf: is considered BAD STYLE.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8695
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8696
     Advice2:
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  8697
        Be aware, that using an #isXXX method is usually much faster than 
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  8698
        using #isKindOf:; because isKindOf: has to walk up all the superclass 
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  8699
        hierarchy, comparing every class on the way. 
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  8700
        Due to caching in the VM, a call to #isXXX is normally reached via
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  8701
        a single function call.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8702
     "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8703
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8704
%{  /* NOCONTEXT */
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8705
    register OBJ thisClass;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8706
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8707
    thisClass = __Class(self);
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8708
    while (thisClass != nil) {
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  8709
        if (thisClass == aClass) {
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  8710
            RETURN ( true );
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  8711
        }
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  8712
        thisClass = __ClassInstPtr(thisClass)->c_superclass;
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8713
    }
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8714
    RETURN ( false );
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8715
%}
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8716
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8717
"/
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8718
"/  the above code is equivalent to:
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8719
"/
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8720
"/  thisClass := self class.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8721
"/  [thisClass notNil] whileTrue:[
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8722
"/      thisClass == aClass ifTrue:[^ true].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8723
"/      thisClass := thisClass superclass
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8724
"/  ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8725
"/  ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8726
"/
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8727
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8728
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8729
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8730
isLayout
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8731
    "return true, if the receiver is some kind of layout;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8732
     false is returned here - the method is only redefined in Layout."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8733
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8734
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8735
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8736
6567
cba5c3103600 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6549
diff changeset
  8737
isLazyValue
cba5c3103600 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6549
diff changeset
  8738
    ^ false
cba5c3103600 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6549
diff changeset
  8739
!
cba5c3103600 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6549
diff changeset
  8740
6086
0bd476397581 added isLimitedPrecisionReal
Claus Gittinger <cg@exept.de>
parents: 6074
diff changeset
  8741
isLimitedPrecisionReal
0bd476397581 added isLimitedPrecisionReal
Claus Gittinger <cg@exept.de>
parents: 6074
diff changeset
  8742
    "return true, if the receiver is some kind of floating point number;
0bd476397581 added isLimitedPrecisionReal
Claus Gittinger <cg@exept.de>
parents: 6074
diff changeset
  8743
     false is returned here - the method is only redefined in LimitedPrecisionReal."
0bd476397581 added isLimitedPrecisionReal
Claus Gittinger <cg@exept.de>
parents: 6074
diff changeset
  8744
0bd476397581 added isLimitedPrecisionReal
Claus Gittinger <cg@exept.de>
parents: 6074
diff changeset
  8745
    ^ false
0bd476397581 added isLimitedPrecisionReal
Claus Gittinger <cg@exept.de>
parents: 6074
diff changeset
  8746
!
0bd476397581 added isLimitedPrecisionReal
Claus Gittinger <cg@exept.de>
parents: 6074
diff changeset
  8747
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8748
isList
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8749
    "return true, if the receiver is some kind of list collection;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8750
     false is returned here - the method is only redefined in List."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8751
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8752
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8753
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8754
    "Created: / 11.2.2000 / 01:37:05 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8755
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8756
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8757
isLiteral
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8758
    "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
  8759
     false is returned here - the method is redefined in some classes."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8760
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8761
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8762
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8763
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8764
isMemberOf:aClass
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8765
    "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
  8766
     Advice: 
8833
717b01292d0e comments
Stefan Vogel <sv@exept.de>
parents: 8832
diff changeset
  8767
        use of this to check objects for certain attributes/protocol should
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  8768
        be avoided; it limits the reusability of your classes by limiting use
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  8769
        to instances of a certain class.
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  8770
        Use check-methods to check an object for a certain attributes/protocol
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  8771
        (such as #isXXX, #respondsTo: or #isNumber);
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  8772
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  8773
        Using #isMemberOf: is considered BAD STYLE.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8774
     Notice:
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  8775
        This method is open coded (inlined) by the compiler(s)
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  8776
        - redefining it may not work as expected."
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8777
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8778
    ^ (self class) == aClass
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8779
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8780
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8781
isMeta
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8782
    "return true, if the receiver is some kind of metaclass;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8783
     false is returned here - the method is only redefined in Metaclass."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8784
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8785
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8786
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8787
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8788
isMethod
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8789
    "return true, if the receiver is some kind of method;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8790
     false returned here - the method is only redefined in Method."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8791
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8792
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8793
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8794
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8795
isMorph
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8796
    "return true, if the receiver is some kind of morph;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8797
     false is returned here - the method is only redefined in Morph."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8798
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8799
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8800
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8801
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8802
isNameSpace
9221
d8fff4a78065 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9216
diff changeset
  8803
    "return true, if the receiver is a nameSpace.
d8fff4a78065 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9216
diff changeset
  8804
     False is returned here - the method is only redefined in Namespace."
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8805
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8806
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8807
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8808
    "Created: / 11.10.1996 / 18:08:56 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8809
    "Modified: / 8.5.1998 / 21:26:05 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8810
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8811
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8812
isNamespace
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8813
    "return true, if this is a nameSpace.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8814
     false is returned here - the method is only redefined in Namespace."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8815
5869
362be80efcb9 Use <resource:#obsolete>
Stefan Vogel <sv@exept.de>
parents: 5856
diff changeset
  8816
    <resource:#obsolete>
362be80efcb9 Use <resource:#obsolete>
Stefan Vogel <sv@exept.de>
parents: 5856
diff changeset
  8817
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8818
    self obsoleteMethodWarning:'use #isNameSpace'.
6805
f95ad1a82775 *** empty log message ***
ca
parents: 6800
diff changeset
  8819
    ^ self isNameSpace
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8820
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8821
6068
1d5ca1175f3f added #isNilOrEmptyCollection
Claus Gittinger <cg@exept.de>
parents: 6033
diff changeset
  8822
isNil
9221
d8fff4a78065 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9216
diff changeset
  8823
    "Return true, if the receiver is nil.
d8fff4a78065 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9216
diff changeset
  8824
     Because isNil is redefined in UndefinedObject,
d8fff4a78065 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9216
diff changeset
  8825
     the receiver is definitely not nil here, so unconditionally return false.
6068
1d5ca1175f3f added #isNilOrEmptyCollection
Claus Gittinger <cg@exept.de>
parents: 6033
diff changeset
  8826
     Notice:
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  8827
        This method is open coded (inlined) by the compiler(s)
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  8828
        - redefining it may not work as expected."
6068
1d5ca1175f3f added #isNilOrEmptyCollection
Claus Gittinger <cg@exept.de>
parents: 6033
diff changeset
  8829
1d5ca1175f3f added #isNilOrEmptyCollection
Claus Gittinger <cg@exept.de>
parents: 6033
diff changeset
  8830
    ^ false
1d5ca1175f3f added #isNilOrEmptyCollection
Claus Gittinger <cg@exept.de>
parents: 6033
diff changeset
  8831
!
1d5ca1175f3f added #isNilOrEmptyCollection
Claus Gittinger <cg@exept.de>
parents: 6033
diff changeset
  8832
1d5ca1175f3f added #isNilOrEmptyCollection
Claus Gittinger <cg@exept.de>
parents: 6033
diff changeset
  8833
isNilOrEmptyCollection
6182
2b992cf865bc comment
Claus Gittinger <cg@exept.de>
parents: 6181
diff changeset
  8834
    "return true if I am nil or an empty collection - false here.
8833
717b01292d0e comments
Stefan Vogel <sv@exept.de>
parents: 8832
diff changeset
  8835
     Obsolete, use isEmptyOrNil."
717b01292d0e comments
Stefan Vogel <sv@exept.de>
parents: 8832
diff changeset
  8836
717b01292d0e comments
Stefan Vogel <sv@exept.de>
parents: 8832
diff changeset
  8837
    <resource:#obsolete>
6068
1d5ca1175f3f added #isNilOrEmptyCollection
Claus Gittinger <cg@exept.de>
parents: 6033
diff changeset
  8838
1d5ca1175f3f added #isNilOrEmptyCollection
Claus Gittinger <cg@exept.de>
parents: 6033
diff changeset
  8839
    ^ false
6182
2b992cf865bc comment
Claus Gittinger <cg@exept.de>
parents: 6181
diff changeset
  8840
2b992cf865bc comment
Claus Gittinger <cg@exept.de>
parents: 6181
diff changeset
  8841
    "Modified: / 13.11.2001 / 13:28:06 / cg"
6068
1d5ca1175f3f added #isNilOrEmptyCollection
Claus Gittinger <cg@exept.de>
parents: 6033
diff changeset
  8842
!
1d5ca1175f3f added #isNilOrEmptyCollection
Claus Gittinger <cg@exept.de>
parents: 6033
diff changeset
  8843
9005
b82aa6bdc487 #isNonByteCollection
Stefan Vogel <sv@exept.de>
parents: 8986
diff changeset
  8844
isNonByteCollection
b82aa6bdc487 #isNonByteCollection
Stefan Vogel <sv@exept.de>
parents: 8986
diff changeset
  8845
    "return true, if the receiver is some kind of collection, but not a String, ByteArray etc.;
b82aa6bdc487 #isNonByteCollection
Stefan Vogel <sv@exept.de>
parents: 8986
diff changeset
  8846
     false is returned here - the method is redefined in Collection and UninterpretedBytes."
b82aa6bdc487 #isNonByteCollection
Stefan Vogel <sv@exept.de>
parents: 8986
diff changeset
  8847
b82aa6bdc487 #isNonByteCollection
Stefan Vogel <sv@exept.de>
parents: 8986
diff changeset
  8848
    ^ false
b82aa6bdc487 #isNonByteCollection
Stefan Vogel <sv@exept.de>
parents: 8986
diff changeset
  8849
b82aa6bdc487 #isNonByteCollection
Stefan Vogel <sv@exept.de>
parents: 8986
diff changeset
  8850
    "
b82aa6bdc487 #isNonByteCollection
Stefan Vogel <sv@exept.de>
parents: 8986
diff changeset
  8851
        21 isNonByteCollection
b82aa6bdc487 #isNonByteCollection
Stefan Vogel <sv@exept.de>
parents: 8986
diff changeset
  8852
        'abc' isNonByteCollection
b82aa6bdc487 #isNonByteCollection
Stefan Vogel <sv@exept.de>
parents: 8986
diff changeset
  8853
        #'abc' isNonByteCollection
b82aa6bdc487 #isNonByteCollection
Stefan Vogel <sv@exept.de>
parents: 8986
diff changeset
  8854
        #[1 2 3] isNonByteCollection
b82aa6bdc487 #isNonByteCollection
Stefan Vogel <sv@exept.de>
parents: 8986
diff changeset
  8855
        #(1 2 3) isNonByteCollection
b82aa6bdc487 #isNonByteCollection
Stefan Vogel <sv@exept.de>
parents: 8986
diff changeset
  8856
    "
b82aa6bdc487 #isNonByteCollection
Stefan Vogel <sv@exept.de>
parents: 8986
diff changeset
  8857
!
b82aa6bdc487 #isNonByteCollection
Stefan Vogel <sv@exept.de>
parents: 8986
diff changeset
  8858
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8859
isNumber
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8860
    "return true, if the receiver is some kind of number;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8861
     false is returned here - the method is only redefined in Number."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8862
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8863
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8864
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8865
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8866
isOrderedCollection
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8867
    "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
  8868
     false is returned here - the method is only redefined in OrderedCollection."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8869
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8870
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8871
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8872
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8873
isPoint
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8874
    "return true, if the receiver is some kind of point;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8875
     false is returned here - the method is only redefined in Point."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8876
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8877
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8878
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8879
9515
89c8275e009a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9509
diff changeset
  8880
isProjectDefinition
89c8275e009a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9509
diff changeset
  8881
    "return true, if the receiver is a projectDefinition.
89c8275e009a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9509
diff changeset
  8882
     False is returned here - the method is only redefined in ProjectDefinition."
89c8275e009a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9509
diff changeset
  8883
89c8275e009a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9509
diff changeset
  8884
    ^ false
89c8275e009a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9509
diff changeset
  8885
89c8275e009a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9509
diff changeset
  8886
    "Created: / 10-08-2006 / 16:24:53 / cg"
89c8275e009a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9509
diff changeset
  8887
!
89c8275e009a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9509
diff changeset
  8888
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8889
isRectangle
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8890
    "return true, if the receiver is some kind of rectangle;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8891
     false is returned here - the method is only redefined in Rectangle."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8892
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8893
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8894
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8895
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8896
isRemoteObject
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8897
    "return true, if the receiver is some kind of remoteObject,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8898
     false if its local - the method is only redefined in RemoteObject."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8899
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8900
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8901
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8902
    "Created: 28.10.1996 / 15:18:45 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8903
    "Modified: 28.10.1996 / 15:20:57 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8904
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8905
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8906
isSequenceable
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8907
    "return true, if the receiver is some kind of sequenceable collection;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8908
     false is returned here - the method is only redefined in SequenceableCollection."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8909
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8910
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8911
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8912
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8913
isSequenceableCollection
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8914
    "OBSOLETE: use isSequenceable for ST-80 compatibility.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8915
     This method is a historic leftover and will be removed soon ...
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8916
     (although its name is much better than #isSequenceable - sigh)"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8917
5869
362be80efcb9 Use <resource:#obsolete>
Stefan Vogel <sv@exept.de>
parents: 5856
diff changeset
  8918
    <resource:#obsolete>
362be80efcb9 Use <resource:#obsolete>
Stefan Vogel <sv@exept.de>
parents: 5856
diff changeset
  8919
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8920
    self obsoleteMethodWarning:'use #isSequenceable'.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8921
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8922
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8923
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8924
isStream
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8925
    "return true, if the receiver is some kind of stream;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8926
     false is returned here - the method is only redefined in Stream."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8927
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8928
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8929
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8930
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8931
isString
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8932
    "return true, if the receiver is some kind of string;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8933
     false is returned here - the method is only redefined in CharacterArray."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8934
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8935
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8936
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8937
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8938
isStringCollection
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8939
    "return true, if the receiver is some kind of stringCollection;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8940
     false is returned here - the method is only redefined in StringCollection."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8941
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8942
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8943
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8944
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8945
isSymbol
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8946
    "return true, if the receiver is some kind of symbol;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8947
     false is returned here - the method is only redefined in Symbol."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8948
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8949
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8950
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8951
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8952
isText
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8953
    "return true, if the receiver is some kind of text object;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8954
     false is returned here - the method is only redefined in Text."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8955
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8956
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8957
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8958
    "Created: 12.5.1996 / 10:56:50 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8959
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8960
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8961
isValueModel
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8962
    "return true, if the receiver is some kind of valueModel;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8963
     false is returned here - the method is only redefined in ValueModel."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8964
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8965
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8966
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8967
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8968
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8969
isVariable
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8970
    "return true if the receiver has indexed instance variables,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8971
     false otherwise."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8972
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8973
    ^ self class isVariable
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8974
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8975
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8976
isVariableBinding
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8977
    "return true, if this is a binding for a variable.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8978
     false is returned here - the method is only redefined in Binding."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8979
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8980
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8981
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8982
    "Created: / 19.6.1997 / 17:38:44 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8983
    "Modified: / 8.5.1998 / 21:26:55 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8984
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8985
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8986
isView
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8987
    "return true, if the receiver is some kind of view;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8988
     false is returned here - the method is only redefined in View."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8989
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8990
    ^ false
6068
1d5ca1175f3f added #isNilOrEmptyCollection
Claus Gittinger <cg@exept.de>
parents: 6033
diff changeset
  8991
!
1d5ca1175f3f added #isNilOrEmptyCollection
Claus Gittinger <cg@exept.de>
parents: 6033
diff changeset
  8992
6932
1e1d296d4747 + #notEmptyOrNil
penk
parents: 6926
diff changeset
  8993
notEmptyOrNil
1e1d296d4747 + #notEmptyOrNil
penk
parents: 6926
diff changeset
  8994
    "Squeak compatibility:
1e1d296d4747 + #notEmptyOrNil
penk
parents: 6926
diff changeset
  8995
     return true if I am neither nil nor an empty collection.
1e1d296d4747 + #notEmptyOrNil
penk
parents: 6926
diff changeset
  8996
     Return true here."
1e1d296d4747 + #notEmptyOrNil
penk
parents: 6926
diff changeset
  8997
1e1d296d4747 + #notEmptyOrNil
penk
parents: 6926
diff changeset
  8998
    ^ true
1e1d296d4747 + #notEmptyOrNil
penk
parents: 6926
diff changeset
  8999
!
1e1d296d4747 + #notEmptyOrNil
penk
parents: 6926
diff changeset
  9000
6068
1d5ca1175f3f added #isNilOrEmptyCollection
Claus Gittinger <cg@exept.de>
parents: 6033
diff changeset
  9001
notNil
9221
d8fff4a78065 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9216
diff changeset
  9002
    "Return true, if the receiver is not nil.
d8fff4a78065 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9216
diff changeset
  9003
     Because notNil is redefined in UndefinedObject,
d8fff4a78065 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9216
diff changeset
  9004
     the receiver is definitely not nil here, so unconditionally return true.
6068
1d5ca1175f3f added #isNilOrEmptyCollection
Claus Gittinger <cg@exept.de>
parents: 6033
diff changeset
  9005
     Notice:
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  9006
        This method is open coded (inlined) by the compiler(s)
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  9007
        - redefining it may not work as expected."
6068
1d5ca1175f3f added #isNilOrEmptyCollection
Claus Gittinger <cg@exept.de>
parents: 6033
diff changeset
  9008
1d5ca1175f3f added #isNilOrEmptyCollection
Claus Gittinger <cg@exept.de>
parents: 6033
diff changeset
  9009
    ^ true
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9010
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9011
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9012
!Object methodsFor:'tracing'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9013
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9014
traceInto:aRequestor level:level from:referrer
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9015
    "double dispatch into tracer, passing my type implicitely in the selector"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9016
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9017
    ^ aRequestor traceObject:self level:level from:referrer
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9018
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9019
    "Created: / 2.9.1999 / 09:05:17 / stefan"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9020
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9021
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9022
!Object methodsFor:'user interaction & notifications'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9023
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9024
activityNotification:aString
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9025
    "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
  9026
     some long-time activity.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9027
     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
  9028
     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
  9029
     and proceed. If there is no handler, this is simply ignored.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9030
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9031
     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
  9032
     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
  9033
     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
  9034
8330
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
  9035
    ActivityNotification isHandled ifTrue:[
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
  9036
        ^ ActivityNotification raiseRequestWith:self errorString:aString
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9037
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9038
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9039
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9040
     nil activityNotification:'hello there'
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9041
     self activityNotification:'hello there'
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9042
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9043
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9044
    "
8330
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
  9045
     ActivityNotification handle:[:ex |
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
  9046
        ex errorString printCR.
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  9047
        ex proceed.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9048
     ] do:[
8330
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
  9049
        'hello' printCR.
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  9050
        self activityNotification:'doing some long time computation'.
8330
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
  9051
        'world' printCR.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9052
     ]
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9053
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9054
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9055
    "Modified: 16.12.1995 / 18:23:42 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9056
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9057
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9058
confirm:aString
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9059
    "launch a confirmer, which allows user to enter yes or no.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9060
     return true for yes, false for no.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9061
     If no GUI is present (headless applications), true is returned."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9062
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9063
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9064
     on systems without GUI, or during startup, output a message
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9065
     and return true (as if yes was answered)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9066
     Q: should we ask user by reading Stdin ?
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9067
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9068
    Smalltalk isInitialized ifFalse:[
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  9069
        '*** confirmation requested during initialization:' errorPrintCR. 
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  9070
        aString errorPrintCR.
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  9071
        '*** I''ll continue, assuming <yes> ...' errorPrintCR.
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  9072
        ^ true
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9073
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9074
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9075
    (Dialog isNil 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9076
    or:[Screen isNil
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9077
    or:[Screen current isNil
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9078
    or:[Screen current isOpen not]]]) ifTrue:[       
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  9079
        'confirm: ' infoPrint.
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  9080
        aString infoPrintCR.
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  9081
        'continue, assuming <yes>' infoPrintCR.
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  9082
        ^ true
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9083
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9084
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9085
    Dialog autoload.        "in case its autoloaded"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9086
    ^ Dialog confirm:aString
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9087
        
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9088
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9089
     nil confirm:'hello'
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9090
     self confirm:'hello'
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9091
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9092
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9093
    "Modified: 20.5.1996 / 10:28:40 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9094
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9095
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9096
confirm:aString orCancel:cancelBlock
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9097
    "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
  9098
     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
  9099
     If no GUI is present (headless applications), cancelBlock is returned."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9100
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9101
    |answer|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9102
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9103
    answer := self confirmWithCancel:aString.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9104
    answer isNil ifTrue:[
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  9105
        ^ cancelBlock value
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9106
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9107
    ^ answer
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9108
        
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9109
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9110
     self confirm:'hello' orCancel:[self halt]
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9111
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9112
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9113
    "Modified: 20.5.1996 / 10:28:40 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9114
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9115
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9116
confirmWithCancel:aString
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9117
    "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
  9118
     return true for yes, false for no, nil for cancel.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9119
     If no GUI is present (headless applications), nil is returned."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9120
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9121
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9122
     on systems without GUI, or during startup, output a message
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9123
     and return true (as if yes was answered)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9124
     Q: should we ask user by reading Stdin ?
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9125
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9126
    Smalltalk isInitialized ifFalse:[
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  9127
        '*** confirmation requested during initialization:' errorPrintCR. 
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  9128
        aString errorPrintCR.
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  9129
        '*** I''ll continue, assuming <cancel> ...' errorPrintCR.
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  9130
        ^ nil
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9131
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9132
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9133
    (Dialog isNil 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9134
    or:[Screen isNil
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9135
    or:[Screen current isNil
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9136
    or:[Screen current isOpen not]]]) ifTrue:[       
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  9137
        'confirm: ' infoPrint.
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  9138
        aString infoPrintCR.
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  9139
        'continue, assuming <cancel>' infoPrintCR.
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  9140
        ^ nil
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9141
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9142
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9143
    Dialog autoload.        "in case its autoloaded"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9144
    ^ Dialog confirmWithCancel:aString
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9145
        
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9146
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9147
     nil confirmWithCancel:'hello' 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9148
     self confirmWithCancel:'hello'
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9149
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9150
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9151
    "Modified: 20.5.1996 / 10:28:40 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9152
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9153
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9154
errorNotify:aString
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9155
    "launch a Notifier, showing top stack, telling user something
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9156
     and give user a chance to enter debugger."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9157
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9158
    ^ self
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  9159
        errorNotify:aString 
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  9160
        from:thisContext sender
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  9161
        allowDebug:true
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9162
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9163
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9164
     nil errorNotify:'hello there'
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9165
     self errorNotify:'hello there'
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9166
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9167
6199
5fcf06f17cee *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6196
diff changeset
  9168
    "Modified: / 16.11.2001 / 15:36:49 / cg"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9169
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9170
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9171
errorNotify:aString from:aContext
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9172
    "launch a Notifier, showing top stack (above aContext), 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9173
     telling user something and give user a chance to enter debugger."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9174
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9175
    ^ self errorNotify:aString from:aContext allowDebug:true
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9176
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9177
    "Modified: / 17.8.1998 / 10:09:27 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9178
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9179
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9180
errorNotify:aString from:aContext allowDebug:allowDebug
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9181
    "launch a Notifier, showing top stack (above aContext), 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9182
     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
  9183
6647
79c298b93c07 #errorNotify -- allow copying the backtrace
Stefan Vogel <sv@exept.de>
parents: 6631
diff changeset
  9184
    |currentScreen con sender action boxLabels boxValues default|
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9185
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9186
    Smalltalk isInitialized ifFalse:[
6647
79c298b93c07 #errorNotify -- allow copying the backtrace
Stefan Vogel <sv@exept.de>
parents: 6631
diff changeset
  9187
        'errorNotification: ' print. aString printCR.
8397
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  9188
        ^ nil
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9189
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9190
    (Dialog isNil 
6647
79c298b93c07 #errorNotify -- allow copying the backtrace
Stefan Vogel <sv@exept.de>
parents: 6631
diff changeset
  9191
     or:[Screen isNil
79c298b93c07 #errorNotify -- allow copying the backtrace
Stefan Vogel <sv@exept.de>
parents: 6631
diff changeset
  9192
     or:[(currentScreen := Screen current) isNil
79c298b93c07 #errorNotify -- allow copying the backtrace
Stefan Vogel <sv@exept.de>
parents: 6631
diff changeset
  9193
     or:[currentScreen isOpen not]]]) ifTrue:[       
79c298b93c07 #errorNotify -- allow copying the backtrace
Stefan Vogel <sv@exept.de>
parents: 6631
diff changeset
  9194
        "
79c298b93c07 #errorNotify -- allow copying the backtrace
Stefan Vogel <sv@exept.de>
parents: 6631
diff changeset
  9195
         on systems without GUI, simply show
79c298b93c07 #errorNotify -- allow copying the backtrace
Stefan Vogel <sv@exept.de>
parents: 6631
diff changeset
  9196
         the message on the Transcript and abort.
79c298b93c07 #errorNotify -- allow copying the backtrace
Stefan Vogel <sv@exept.de>
parents: 6631
diff changeset
  9197
        "
79c298b93c07 #errorNotify -- allow copying the backtrace
Stefan Vogel <sv@exept.de>
parents: 6631
diff changeset
  9198
        Transcript showCR:aString.
8397
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  9199
        AbortOperationRequest raise.
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  9200
        "not reached"
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  9201
        ^ nil
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9202
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9203
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9204
    Processor activeProcessIsSystemProcess ifTrue:[
6647
79c298b93c07 #errorNotify -- allow copying the backtrace
Stefan Vogel <sv@exept.de>
parents: 6631
diff changeset
  9205
        action := #debug.
79c298b93c07 #errorNotify -- allow copying the backtrace
Stefan Vogel <sv@exept.de>
parents: 6631
diff changeset
  9206
        sender := aContext.
79c298b93c07 #errorNotify -- allow copying the backtrace
Stefan Vogel <sv@exept.de>
parents: 6631
diff changeset
  9207
        Debugger isNil ifTrue:[
79c298b93c07 #errorNotify -- allow copying the backtrace
Stefan Vogel <sv@exept.de>
parents: 6631
diff changeset
  9208
            '****************** Cought Error while in SystemProcess ****************' errorPrintCR.
79c298b93c07 #errorNotify -- allow copying the backtrace
Stefan Vogel <sv@exept.de>
parents: 6631
diff changeset
  9209
            thisContext fullPrintAll.
79c298b93c07 #errorNotify -- allow copying the backtrace
Stefan Vogel <sv@exept.de>
parents: 6631
diff changeset
  9210
            action := #abort.
79c298b93c07 #errorNotify -- allow copying the backtrace
Stefan Vogel <sv@exept.de>
parents: 6631
diff changeset
  9211
        ].
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9212
    ] ifFalse:[
6647
79c298b93c07 #errorNotify -- allow copying the backtrace
Stefan Vogel <sv@exept.de>
parents: 6631
diff changeset
  9213
        Dialog autoload.        "in case it's autoloaded"
79c298b93c07 #errorNotify -- allow copying the backtrace
Stefan Vogel <sv@exept.de>
parents: 6631
diff changeset
  9214
79c298b93c07 #errorNotify -- allow copying the backtrace
Stefan Vogel <sv@exept.de>
parents: 6631
diff changeset
  9215
        Error handle:[:ex |
79c298b93c07 #errorNotify -- allow copying the backtrace
Stefan Vogel <sv@exept.de>
parents: 6631
diff changeset
  9216
            "/ a recursive error - quickly enter debugger
79c298b93c07 #errorNotify -- allow copying the backtrace
Stefan Vogel <sv@exept.de>
parents: 6631
diff changeset
  9217
            "/ this happened, when I corrupted the Dialog class ...
7208
b95620b2c6b6 #errorSignal -> #description
Stefan Vogel <sv@exept.de>
parents: 7204
diff changeset
  9218
            ('Object [error]: ' , ex description , ' caught in errorNotification') errorPrintCR.
6647
79c298b93c07 #errorNotify -- allow copying the backtrace
Stefan Vogel <sv@exept.de>
parents: 6631
diff changeset
  9219
            action := #debug.
79c298b93c07 #errorNotify -- allow copying the backtrace
Stefan Vogel <sv@exept.de>
parents: 6631
diff changeset
  9220
            ex return.
79c298b93c07 #errorNotify -- allow copying the backtrace
Stefan Vogel <sv@exept.de>
parents: 6631
diff changeset
  9221
        ] do:[ |s|
79c298b93c07 #errorNotify -- allow copying the backtrace
Stefan Vogel <sv@exept.de>
parents: 6631
diff changeset
  9222
            sender := aContext.
79c298b93c07 #errorNotify -- allow copying the backtrace
Stefan Vogel <sv@exept.de>
parents: 6631
diff changeset
  9223
            sender isNil ifTrue:[
79c298b93c07 #errorNotify -- allow copying the backtrace
Stefan Vogel <sv@exept.de>
parents: 6631
diff changeset
  9224
                sender := thisContext sender.
79c298b93c07 #errorNotify -- allow copying the backtrace
Stefan Vogel <sv@exept.de>
parents: 6631
diff changeset
  9225
            ].
7576
7e2e97bd0973 interrestingContextFrom - duplicated code removed
Claus Gittinger <cg@exept.de>
parents: 7567
diff changeset
  9226
            con := sender.
6647
79c298b93c07 #errorNotify -- allow copying the backtrace
Stefan Vogel <sv@exept.de>
parents: 6631
diff changeset
  9227
79c298b93c07 #errorNotify -- allow copying the backtrace
Stefan Vogel <sv@exept.de>
parents: 6631
diff changeset
  9228
            "/ skip intermediate (signal & exception) contexts
79c298b93c07 #errorNotify -- allow copying the backtrace
Stefan Vogel <sv@exept.de>
parents: 6631
diff changeset
  9229
            DebugView notNil ifTrue:[
7576
7e2e97bd0973 interrestingContextFrom - duplicated code removed
Claus Gittinger <cg@exept.de>
parents: 7567
diff changeset
  9230
                con := DebugView interestingContextFrom:sender
6647
79c298b93c07 #errorNotify -- allow copying the backtrace
Stefan Vogel <sv@exept.de>
parents: 6631
diff changeset
  9231
            ].
79c298b93c07 #errorNotify -- allow copying the backtrace
Stefan Vogel <sv@exept.de>
parents: 6631
diff changeset
  9232
79c298b93c07 #errorNotify -- allow copying the backtrace
Stefan Vogel <sv@exept.de>
parents: 6631
diff changeset
  9233
            "/ show the first few contexts
79c298b93c07 #errorNotify -- allow copying the backtrace
Stefan Vogel <sv@exept.de>
parents: 6631
diff changeset
  9234
79c298b93c07 #errorNotify -- allow copying the backtrace
Stefan Vogel <sv@exept.de>
parents: 6631
diff changeset
  9235
            s := WriteStream with:aString.
79c298b93c07 #errorNotify -- allow copying the backtrace
Stefan Vogel <sv@exept.de>
parents: 6631
diff changeset
  9236
            s cr; cr.
79c298b93c07 #errorNotify -- allow copying the backtrace
Stefan Vogel <sv@exept.de>
parents: 6631
diff changeset
  9237
            1 to:15 do:[:n |
79c298b93c07 #errorNotify -- allow copying the backtrace
Stefan Vogel <sv@exept.de>
parents: 6631
diff changeset
  9238
                con notNil ifTrue:[
79c298b93c07 #errorNotify -- allow copying the backtrace
Stefan Vogel <sv@exept.de>
parents: 6631
diff changeset
  9239
                    con printOn:s.
79c298b93c07 #errorNotify -- allow copying the backtrace
Stefan Vogel <sv@exept.de>
parents: 6631
diff changeset
  9240
                    s cr.
79c298b93c07 #errorNotify -- allow copying the backtrace
Stefan Vogel <sv@exept.de>
parents: 6631
diff changeset
  9241
                    con := con sender
79c298b93c07 #errorNotify -- allow copying the backtrace
Stefan Vogel <sv@exept.de>
parents: 6631
diff changeset
  9242
                ]
79c298b93c07 #errorNotify -- allow copying the backtrace
Stefan Vogel <sv@exept.de>
parents: 6631
diff changeset
  9243
            ].
79c298b93c07 #errorNotify -- allow copying the backtrace
Stefan Vogel <sv@exept.de>
parents: 6631
diff changeset
  9244
79c298b93c07 #errorNotify -- allow copying the backtrace
Stefan Vogel <sv@exept.de>
parents: 6631
diff changeset
  9245
            (allowDebug and:[Debugger notNil]) ifTrue:[
79c298b93c07 #errorNotify -- allow copying the backtrace
Stefan Vogel <sv@exept.de>
parents: 6631
diff changeset
  9246
                boxLabels := #('Proceed' 'Abort' 'Copy Trace and Abort' 'Debug').
79c298b93c07 #errorNotify -- allow copying the backtrace
Stefan Vogel <sv@exept.de>
parents: 6631
diff changeset
  9247
                boxValues := #(#proceed  #abort  #copy                  #debug).
79c298b93c07 #errorNotify -- allow copying the backtrace
Stefan Vogel <sv@exept.de>
parents: 6631
diff changeset
  9248
                default := #debug.
79c298b93c07 #errorNotify -- allow copying the backtrace
Stefan Vogel <sv@exept.de>
parents: 6631
diff changeset
  9249
            ] ifFalse:[
79c298b93c07 #errorNotify -- allow copying the backtrace
Stefan Vogel <sv@exept.de>
parents: 6631
diff changeset
  9250
                boxLabels := #('Proceed' 'Abort' 'Copy Trace and Abort').
79c298b93c07 #errorNotify -- allow copying the backtrace
Stefan Vogel <sv@exept.de>
parents: 6631
diff changeset
  9251
                boxValues := #(#proceed  #abort  #copy).
79c298b93c07 #errorNotify -- allow copying the backtrace
Stefan Vogel <sv@exept.de>
parents: 6631
diff changeset
  9252
                default := #abort.
79c298b93c07 #errorNotify -- allow copying the backtrace
Stefan Vogel <sv@exept.de>
parents: 6631
diff changeset
  9253
            ].
79c298b93c07 #errorNotify -- allow copying the backtrace
Stefan Vogel <sv@exept.de>
parents: 6631
diff changeset
  9254
79c298b93c07 #errorNotify -- allow copying the backtrace
Stefan Vogel <sv@exept.de>
parents: 6631
diff changeset
  9255
            action := Dialog 
79c298b93c07 #errorNotify -- allow copying the backtrace
Stefan Vogel <sv@exept.de>
parents: 6631
diff changeset
  9256
                    choose:s contents 
79c298b93c07 #errorNotify -- allow copying the backtrace
Stefan Vogel <sv@exept.de>
parents: 6631
diff changeset
  9257
                    label:('Exception [' , Processor activeProcess nameOrId , ']')
79c298b93c07 #errorNotify -- allow copying the backtrace
Stefan Vogel <sv@exept.de>
parents: 6631
diff changeset
  9258
                    image:WarningBox errorIconBitmap
79c298b93c07 #errorNotify -- allow copying the backtrace
Stefan Vogel <sv@exept.de>
parents: 6631
diff changeset
  9259
                    labels:boxLabels
79c298b93c07 #errorNotify -- allow copying the backtrace
Stefan Vogel <sv@exept.de>
parents: 6631
diff changeset
  9260
                    values:boxValues
79c298b93c07 #errorNotify -- allow copying the backtrace
Stefan Vogel <sv@exept.de>
parents: 6631
diff changeset
  9261
                    default:default
79c298b93c07 #errorNotify -- allow copying the backtrace
Stefan Vogel <sv@exept.de>
parents: 6631
diff changeset
  9262
                    onCancel:nil.
79c298b93c07 #errorNotify -- allow copying the backtrace
Stefan Vogel <sv@exept.de>
parents: 6631
diff changeset
  9263
        ].
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9264
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9265
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9266
    action == #debug ifTrue:[
8397
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  9267
        ^ Debugger enter:sender withMessage:aString mayProceed:true
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9268
    ] ifFalse:[
6647
79c298b93c07 #errorNotify -- allow copying the backtrace
Stefan Vogel <sv@exept.de>
parents: 6631
diff changeset
  9269
        action == #proceed ifTrue:[
8397
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  9270
            ^ nil.
6647
79c298b93c07 #errorNotify -- allow copying the backtrace
Stefan Vogel <sv@exept.de>
parents: 6631
diff changeset
  9271
        ].
79c298b93c07 #errorNotify -- allow copying the backtrace
Stefan Vogel <sv@exept.de>
parents: 6631
diff changeset
  9272
        action == #copy ifTrue:[ |s|
79c298b93c07 #errorNotify -- allow copying the backtrace
Stefan Vogel <sv@exept.de>
parents: 6631
diff changeset
  9273
            s := '' writeStream.
79c298b93c07 #errorNotify -- allow copying the backtrace
Stefan Vogel <sv@exept.de>
parents: 6631
diff changeset
  9274
            sender fullPrintAllOn:s.
8563
9ea42d4571b5 set selection interface changed
ca
parents: 8555
diff changeset
  9275
            currentScreen rootView setClipboardText:s contents.
6647
79c298b93c07 #errorNotify -- allow copying the backtrace
Stefan Vogel <sv@exept.de>
parents: 6631
diff changeset
  9276
        ].
8397
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  9277
        AbortOperationRequest raise.
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  9278
        "not reached"
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  9279
    ].
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  9280
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9281
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9282
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9283
     nil errorNotify:'hello there'
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9284
     self errorNotify:'hello there'
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9285
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9286
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9287
    "Created: / 17.8.1998 / 10:09:26 / cg"
6199
5fcf06f17cee *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6196
diff changeset
  9288
    "Modified: / 16.11.2001 / 15:40:12 / cg"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9289
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9290
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9291
information:aString
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9292
    "launch an InfoBox, telling user something. 
7033
c4183ea85a71 Now Warning is a subclass of UserNotification.
Stefan Vogel <sv@exept.de>
parents: 7031
diff changeset
  9293
     These info-boxes can be suppressed by handling  
c4183ea85a71 Now Warning is a subclass of UserNotification.
Stefan Vogel <sv@exept.de>
parents: 7031
diff changeset
  9294
     UserNotification or InformationSignal and proceeding in the handler.
c4183ea85a71 Now Warning is a subclass of UserNotification.
Stefan Vogel <sv@exept.de>
parents: 7031
diff changeset
  9295
     Use #notify: for more important messages.
8371
4493f5ac7405 *** empty log message ***
ca
parents: 8330
diff changeset
  9296
     If nobody handles the exception, the default action of UserNotification
7033
c4183ea85a71 Now Warning is a subclass of UserNotification.
Stefan Vogel <sv@exept.de>
parents: 7031
diff changeset
  9297
     pops up a warn dialog."
c4183ea85a71 Now Warning is a subclass of UserNotification.
Stefan Vogel <sv@exept.de>
parents: 7031
diff changeset
  9298
7035
1d049fb7ae5a Make UserInformation a class based exception
Stefan Vogel <sv@exept.de>
parents: 7033
diff changeset
  9299
    UserInformation raiseRequestWith:self errorString:aString
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9300
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9301
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9302
     nil information:'hello there'
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9303
     self information:'hello there'
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9304
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9305
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9306
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9307
     InformationSignal handle:[:ex |
7033
c4183ea85a71 Now Warning is a subclass of UserNotification.
Stefan Vogel <sv@exept.de>
parents: 7031
diff changeset
  9308
        'no box popped' printCR.
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  9309
        ex proceed.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9310
     ] do:[
7033
c4183ea85a71 Now Warning is a subclass of UserNotification.
Stefan Vogel <sv@exept.de>
parents: 7031
diff changeset
  9311
        'hello' printCR.
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  9312
        self information:'some info'.
7033
c4183ea85a71 Now Warning is a subclass of UserNotification.
Stefan Vogel <sv@exept.de>
parents: 7031
diff changeset
  9313
        'world' printCR.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9314
     ]
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9315
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9316
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9317
    "Modified: 24.11.1995 / 22:29:49 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9318
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9319
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9320
notify:aString
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9321
    "launch a Notifier, telling user something.
7033
c4183ea85a71 Now Warning is a subclass of UserNotification.
Stefan Vogel <sv@exept.de>
parents: 7031
diff changeset
  9322
     Use #information: for ignorable messages.
c4183ea85a71 Now Warning is a subclass of UserNotification.
Stefan Vogel <sv@exept.de>
parents: 7031
diff changeset
  9323
     If nobody handles the exception, the dafault action of UserNotification
c4183ea85a71 Now Warning is a subclass of UserNotification.
Stefan Vogel <sv@exept.de>
parents: 7031
diff changeset
  9324
     pops up a warn dialog."
c4183ea85a71 Now Warning is a subclass of UserNotification.
Stefan Vogel <sv@exept.de>
parents: 7031
diff changeset
  9325
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9326
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9327
    Smalltalk isInitialized ifFalse:[
6656
e434adf0a1f3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6654
diff changeset
  9328
        "/ thisContext fullPrintAll.
7033
c4183ea85a71 Now Warning is a subclass of UserNotification.
Stefan Vogel <sv@exept.de>
parents: 7031
diff changeset
  9329
        'information: ' print. aString printCR.
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  9330
        ^ self
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9331
    ].
7033
c4183ea85a71 Now Warning is a subclass of UserNotification.
Stefan Vogel <sv@exept.de>
parents: 7031
diff changeset
  9332
    UserNotification raiseRequestWith:self errorString:aString.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9333
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9334
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9335
     nil notify:'hello there'
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9336
     self notify:'hello there'
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9337
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9338
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9339
    "Modified: 20.5.1996 / 10:28:48 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9340
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9341
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9342
warn:aString
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9343
    "launch a WarningBox, telling user something.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9344
     These warn-boxes can be suppressed by handling the 
7033
c4183ea85a71 Now Warning is a subclass of UserNotification.
Stefan Vogel <sv@exept.de>
parents: 7031
diff changeset
  9345
     UserNotification- or WarningSignal and proceeding in the handler.
c4183ea85a71 Now Warning is a subclass of UserNotification.
Stefan Vogel <sv@exept.de>
parents: 7031
diff changeset
  9346
     If nobody handles the exception, the dafault action of Warning
c4183ea85a71 Now Warning is a subclass of UserNotification.
Stefan Vogel <sv@exept.de>
parents: 7031
diff changeset
  9347
     pops up a warn dialog."
c4183ea85a71 Now Warning is a subclass of UserNotification.
Stefan Vogel <sv@exept.de>
parents: 7031
diff changeset
  9348
c4183ea85a71 Now Warning is a subclass of UserNotification.
Stefan Vogel <sv@exept.de>
parents: 7031
diff changeset
  9349
    Warning raiseRequestWith:self errorString:aString
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9350
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9351
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9352
     nil warn:'hello there'
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9353
     self warn:'hello there'
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9354
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9355
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9356
    "
7033
c4183ea85a71 Now Warning is a subclass of UserNotification.
Stefan Vogel <sv@exept.de>
parents: 7031
diff changeset
  9357
     Warning handle:[:ex |
c4183ea85a71 Now Warning is a subclass of UserNotification.
Stefan Vogel <sv@exept.de>
parents: 7031
diff changeset
  9358
        Transcript showCR:ex description.
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  9359
        ex proceed.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9360
     ] do:[
7033
c4183ea85a71 Now Warning is a subclass of UserNotification.
Stefan Vogel <sv@exept.de>
parents: 7031
diff changeset
  9361
        'hello' printCR.
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  9362
        self warn:'some info'.
7033
c4183ea85a71 Now Warning is a subclass of UserNotification.
Stefan Vogel <sv@exept.de>
parents: 7031
diff changeset
  9363
        'world' printCR.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9364
     ]
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9365
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9366
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9367
    "Modified: 20.5.1996 / 10:28:53 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9368
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9369
8397
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  9370
!Object methodsFor:'visiting'!
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  9371
8426
b4195c5f9450 +acceptVisitor
Claus Gittinger <cg@exept.de>
parents: 8413
diff changeset
  9372
acceptVisitor:aVisitor
b4195c5f9450 +acceptVisitor
Claus Gittinger <cg@exept.de>
parents: 8413
diff changeset
  9373
    "double-dispatch onto a Visitor."
b4195c5f9450 +acceptVisitor
Claus Gittinger <cg@exept.de>
parents: 8413
diff changeset
  9374
b4195c5f9450 +acceptVisitor
Claus Gittinger <cg@exept.de>
parents: 8413
diff changeset
  9375
    ^ self acceptVisitor:aVisitor with:nil
b4195c5f9450 +acceptVisitor
Claus Gittinger <cg@exept.de>
parents: 8413
diff changeset
  9376
!
b4195c5f9450 +acceptVisitor
Claus Gittinger <cg@exept.de>
parents: 8413
diff changeset
  9377
8397
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  9378
acceptVisitor:aVisitor with:aParameter
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  9379
    "double-dispatch onto a Visitor.
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  9380
     Subclasses redefine this"
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  9381
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  9382
    ^ aVisitor visitObject:self with:aParameter
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  9383
!
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  9384
8879
69a4b8db130c #elementDescriptorFor: take care vor nil-aspects
Stefan Vogel <sv@exept.de>
parents: 8876
diff changeset
  9385
elementDescriptorFor:anAspectSymbol
8397
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  9386
    "answer a collection of associations containing the
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  9387
     objects state to be encoded for aspect.
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  9388
     Association key is the instance variable name or access selector,
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  9389
     association value is the contents of the instance variable.
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  9390
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  9391
     The default is to return the contents of all non-nil instance variables"
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  9392
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  9393
    |ret|
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  9394
8879
69a4b8db130c #elementDescriptorFor: take care vor nil-aspects
Stefan Vogel <sv@exept.de>
parents: 8876
diff changeset
  9395
    ret := 0.
69a4b8db130c #elementDescriptorFor: take care vor nil-aspects
Stefan Vogel <sv@exept.de>
parents: 8876
diff changeset
  9396
    anAspectSymbol notNil ifTrue:[
69a4b8db130c #elementDescriptorFor: take care vor nil-aspects
Stefan Vogel <sv@exept.de>
parents: 8876
diff changeset
  9397
        ret := self perform:anAspectSymbol ifNotUnderstood:[0].
69a4b8db130c #elementDescriptorFor: take care vor nil-aspects
Stefan Vogel <sv@exept.de>
parents: 8876
diff changeset
  9398
    ].
8397
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  9399
    ret == 0 ifTrue:[
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  9400
        ^ self elementDescriptorForNonNilInstanceVariables
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  9401
    ].
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  9402
    ^ ret.
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  9403
!
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  9404
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  9405
elementDescriptorForInstanceVariables
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  9406
    "return all instance variables for visiting/encoding"
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  9407
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  9408
    ^ self elementDescriptorForInstanceVariablesMatching:[:val | true].
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  9409
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  9410
    "
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  9411
      #(1 2 3 nil true symbol) elementDescriptorForInstanceVariables
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  9412
      Dictionary new elementDescriptorForInstanceVariables
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  9413
      (5 @ nil) elementDescriptorForInstanceVariables
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  9414
    "
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  9415
!
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  9416
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  9417
elementDescriptorForInstanceVariablesMatching:aBlock
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  9418
    "return all instance variables which conform to aBlock, for encoding/visiting.
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  9419
     Indexed vars are all included."
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  9420
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  9421
    |instVarNames theClass children
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  9422
     instSize "{ Class: SmallInteger }" 
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  9423
     varSize "{ Class: SmallInteger }"|
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  9424
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  9425
    theClass := self class.
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  9426
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  9427
    instSize := theClass instSize.
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  9428
    varSize := theClass isVariable ifTrue:[self basicSize] ifFalse:[0].
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  9429
    children := OrderedCollection new:(instSize + varSize).
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  9430
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  9431
    instVarNames := theClass allInstVarNames.
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  9432
    1 to:instSize do:[:i | |var|
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  9433
        var := self instVarAt:i.
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  9434
        (aBlock value:var) ifTrue:[
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  9435
            children add:((instVarNames at:i) -> var)
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  9436
        ]
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  9437
    ].
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  9438
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  9439
    varSize ~~ 0 ifTrue:[
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  9440
        1 to:varSize do:[:i |
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  9441
            children add:(i -> (self basicAt:i))
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  9442
        ]
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  9443
    ].
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  9444
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  9445
    ^ children.
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  9446
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  9447
    "
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  9448
      #(1 2 3 nil true symbol) elementDescriptorForInstanceVariables
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  9449
      Dictionary new elementDescriptorForInstanceVariables
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  9450
      (5 @ nil) elementDescriptorForInstanceVariables
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  9451
    "
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  9452
!
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  9453
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  9454
elementDescriptorForNonNilInstanceVariables
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  9455
    "return all non-nil instance variables for visiting/encoding"
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  9456
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  9457
    ^ self elementDescriptorForInstanceVariablesMatching:[:val | val notNil].
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  9458
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  9459
    "
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  9460
      #(1 2 3 nil true symbol) elementDescriptorForNonNilInstanceVariables
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  9461
      Dictionary new elementDescriptorForNonNilInstanceVariables
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  9462
      (5 @ nil) elementDescriptorForNonNilInstanceVariables
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  9463
    "
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  9464
! !
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  9465
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9466
!Object class methodsFor:'documentation'!
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  9467
5754
333aba8041c2 checkin from browser
tm
parents: 5706
diff changeset
  9468
version
9515
89c8275e009a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9509
diff changeset
  9469
    ^ '$Header: /cvs/stx/stx/libbasic/Object.st,v 1.563 2006-08-10 14:41:27 cg Exp $'
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  9470
! !
6764
c5455cf45678 perform:withOptional*
Claus Gittinger <cg@exept.de>
parents: 6741
diff changeset
  9471
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9472
Object initialize!