Object.st
author Stefan Vogel <sv@exept.de>
Sat, 24 Nov 2012 13:53:02 +0100
changeset 14532 f15633aab0fe
parent 14527 b933e9f1e53d
child 14534 5c9bbb0cc2ba
permissions -rw-r--r--
class: Object comment/format in: #deepCopyUsing:postCopySelector: changed: #cloneFrom:performing:
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
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
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
"{ Package: 'stx:libbasic' }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    13
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    14
nil subclass:#Object
14292
1cbc2d35aa17 Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents: 14272
diff changeset
    15
	instanceVariableNames:''
1cbc2d35aa17 Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents: 14272
diff changeset
    16
	classVariableNames:'ErrorSignal HaltSignal MessageNotUnderstoodSignal
1cbc2d35aa17 Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents: 14272
diff changeset
    17
		UserInterruptSignal RecursionInterruptSignal
1cbc2d35aa17 Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents: 14272
diff changeset
    18
		ExceptionInterruptSignal SubscriptOutOfBoundsSignal
1cbc2d35aa17 Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents: 14272
diff changeset
    19
		IndexNotFoundSignal NonIntegerIndexSignal NotFoundSignal
1cbc2d35aa17 Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents: 14272
diff changeset
    20
		KeyNotFoundSignal ElementOutOfBoundsSignal UserNotificationSignal
1cbc2d35aa17 Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents: 14272
diff changeset
    21
		InformationSignal WarningSignal PrimitiveFailureSignal
1cbc2d35aa17 Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents: 14272
diff changeset
    22
		DeepCopyErrorSignal AbortSignal ErrorRecursion Dependencies
1cbc2d35aa17 Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents: 14272
diff changeset
    23
		InfoPrinting ActivityNotificationSignal InternalErrorSignal
1cbc2d35aa17 Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents: 14272
diff changeset
    24
		NonWeakDependencies SynchronizationSemaphores ObjectAttributes
1cbc2d35aa17 Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents: 14272
diff changeset
    25
		OSSignalInterruptSignal FinalizationLobby
1cbc2d35aa17 Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents: 14272
diff changeset
    26
		RecursiveStoreStringSignal AbortAllSignal EnabledBreakPoints'
1cbc2d35aa17 Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents: 14272
diff changeset
    27
	poolDictionaries:''
1cbc2d35aa17 Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents: 14272
diff changeset
    28
	category:'Kernel-Objects'
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    29
!
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
!Object class methodsFor:'documentation'!
3023
674376809496 general listView support (#displayOn / widthOn / heightOn)
ca
parents: 3010
diff changeset
    32
5754
333aba8041c2 checkin from browser
tm
parents: 5706
diff changeset
    33
copyright
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    34
"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    35
 COPYRIGHT (c) 1988 by Claus Gittinger
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
    36
              All Rights Reserved
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    37
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    38
 This software is furnished under a license and may be used
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    39
 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
    40
 inclusion of the above copyright notice.   This software may not
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    41
 be provided or otherwise made available to, or used by, any
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    42
 other person.  No title to or ownership of the software is
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    43
 hereby transferred.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    44
"
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
dependencies
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    48
"
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
    49
   ST/X dependencies are slightly modified from ST-80's
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    50
   (we think they are better ;-).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    51
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    52
   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
    53
   cannot be garbage collected because some dependency is present,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    54
   having the object as a dependent of some other object.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    55
   In ST-80, this association remains alive (because a Dictionary
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    56
   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
    57
   to dependent or the dependee.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    58
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    59
   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
    60
   prevent memory leaks.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    61
   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
    62
   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
    63
   need to care about dependencies.
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
    64
   From a philosophical point of view, why should some object depend on
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    65
   something that the programmer considers a dead object ?
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    66
   (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
    67
    that behavior)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    68
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    69
   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
    70
   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
    71
   so these dependents go away, once the model is reclaimed.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    72
   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
    73
   needed, with general objects it is mandatory.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    74
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    75
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    76
   In ST/X, dependencies are implemented using a WeakDictionary; this means,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    77
   that once the dependee dies, the dependency association is removed automatically,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    78
   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
    79
   references exist to the dependent.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    80
   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
    81
   (in case your application heavily depends on the ST-80 mechanism), complementary
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
    82
   protocol to add nonWeak dependencies is provided
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    83
   (see #addNonWeakDependent / #removeNonWeakDependent).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    84
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
   Caveat:
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    87
      since interests are implemented using InterestConverter (which are simply
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    88
      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
    89
      automatically).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    90
      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
    91
      and those would be reclaimed if stored in a weakDictionary.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    92
      This means, that those interests MUST be removed with #retractInterest
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
    93
      (which is bug-compatible to ST-80).
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    94
      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
    95
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
   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
    98
"
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
documentation
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   102
"
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
   103
   Object is the superclass of most other classes.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   104
   (except for nil-subclasses, which inherit nothing,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   105
    to catch any message into their #doesNotUnderstand: method)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   106
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   107
   Protocol which is common to every object is defined here.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   108
   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
   109
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   110
   Object has no instance variables (and may not get any added). One reason is, that
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
   111
   UndefinedObject and SmallInteger are also inheriting from Object - these two cannot
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
   112
   have instance variables (due to their implementation).
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
   113
   The other reason is that the runtime system (VM) knows about the layout of some built-in
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
   114
   classes (think of Class, Method, Block and also Integer or Float).
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
   115
   If you were allowed to add instance variables to Object, the VM had to be recompiled
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   116
   (and also rewritten in some places).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   117
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   118
   [Class variables:]
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   119
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   120
        ErrorSignal     <Signal>        Signal raised for error/error: messages
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   121
                                        also, parent of all other signals.
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   122
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   123
        HaltSignal      <Signal>        Signal raised for halt/halt: messages
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   124
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   125
        MessageNotUnderstoodSignal      Signals raised for various error conditions
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   126
        UserInterruptSignal
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   127
        RecursionInterruptSignal
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   128
        ExceptionInterruptSignal
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   129
        SubscriptOutOfBoundsSignal
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   130
        NonIntegerIndexSignal
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   131
        NotFoundSignal
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   132
        KeyNotFoundSignal
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   133
        ElementOutOfBoundsSignal
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   134
        InformationSignal
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   135
        WarningSignal
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   136
        DeepCopyErrorSignal
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   137
        InternalErrorSignal
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   138
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   139
        AbortSignal      <Signal>       Signal raised by debugger, to abort a computation
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   140
                                        BUT, the debugger will only raise it if it is handled.
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   141
                                        By handling the abortSignal, you can control where the
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   142
                                        debuggers abort-function resumes execution in case of
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   143
                                        an error.
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   144
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   145
        ErrorRecursion   <Boolean>      controls behavior when recursive errors occur (i.e.
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   146
                                        an error while handling an error).
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   147
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   148
        Dependencies     <WeakDependencyDictionary>
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   149
                                        keeps track of object dependencies.
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   150
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   151
        InfoPrinting     <Boolean>      controls weather informational messages
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   152
                                        are printed.
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   153
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   154
        ActivityNotificationSignal <QuerySignal>
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   155
                                         raised on #activityNotification:
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   156
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   157
        NonWeakDependencies <Dictionary> keeps track of object dependencies.
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   158
                                         Dependents stay alive.
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   159
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   160
        SynchronizationSemaphores <WeakIdentityDictionary>
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   161
                                         Semaphores for per-object-monitor.
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
   162
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
    [author:]
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   165
        Claus Gittinger
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   166
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
!Object class methodsFor:'initialization'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   171
5971
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   172
initSignals
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   173
    "called only once - initialize signals"
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   174
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   175
    ErrorSignal := Error.
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   176
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   177
    ControlInterrupt notifierString:'control interrupted'.
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   178
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   179
    HaltSignal := HaltInterrupt.
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   180
    HaltSignal notifierString:'halt encountered'.
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   181
5977
1aa80a42ed64 more class based exceptions
Claus Gittinger <cg@exept.de>
parents: 5971
diff changeset
   182
    MessageNotUnderstoodSignal := MessageNotUnderstood.
5971
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   183
    MessageNotUnderstoodSignal notifierString:'message not understood'.
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   184
6000
d6fbafc5879e more class based exceptions
Claus Gittinger <cg@exept.de>
parents: 5995
diff changeset
   185
    PrimitiveFailureSignal := PrimitiveFailure.
5971
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   186
    PrimitiveFailureSignal notifierString:'primitive failed'.
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   187
8330
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
   188
    InternalErrorSignal := VMInternalError.
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
   189
5971
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   190
    UserInterruptSignal := UserInterrupt.
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   191
    UserInterruptSignal notifierString:'user Interrupt'.
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   192
6146
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   193
    RecursionInterruptSignal := RecursionError.
5971
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   194
    RecursionInterruptSignal notifierString:'recursion limit reached'.
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   195
5977
1aa80a42ed64 more class based exceptions
Claus Gittinger <cg@exept.de>
parents: 5971
diff changeset
   196
    NotFoundSignal := NotFoundError.
5971
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   197
    NotFoundSignal notifierString:'no such element'.
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   198
5977
1aa80a42ed64 more class based exceptions
Claus Gittinger <cg@exept.de>
parents: 5971
diff changeset
   199
    IndexNotFoundSignal := IndexNotFoundError.
5971
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   200
    IndexNotFoundSignal notifierString:'bad index: '.
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   201
5977
1aa80a42ed64 more class based exceptions
Claus Gittinger <cg@exept.de>
parents: 5971
diff changeset
   202
    SubscriptOutOfBoundsSignal := SubscriptOutOfBoundsError.
5971
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   203
    SubscriptOutOfBoundsSignal notifierString:'subscript out of bounds: '.
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   204
5977
1aa80a42ed64 more class based exceptions
Claus Gittinger <cg@exept.de>
parents: 5971
diff changeset
   205
    NonIntegerIndexSignal := NonIntegerIndexError.
1aa80a42ed64 more class based exceptions
Claus Gittinger <cg@exept.de>
parents: 5971
diff changeset
   206
    NonIntegerIndexSignal notifierString:'index must be integer'.
1aa80a42ed64 more class based exceptions
Claus Gittinger <cg@exept.de>
parents: 5971
diff changeset
   207
8330
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
   208
    KeyNotFoundSignal := KeyNotFoundError.
5977
1aa80a42ed64 more class based exceptions
Claus Gittinger <cg@exept.de>
parents: 5971
diff changeset
   209
    KeyNotFoundSignal notifierString:'no such key: '.
1aa80a42ed64 more class based exceptions
Claus Gittinger <cg@exept.de>
parents: 5971
diff changeset
   210
8330
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
   211
    ElementOutOfBoundsSignal := ElementBoundsError.
5971
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   212
7033
c4183ea85a71 Now Warning is a subclass of UserNotification.
Stefan Vogel <sv@exept.de>
parents: 7031
diff changeset
   213
    UserNotificationSignal := UserNotification.
c4183ea85a71 Now Warning is a subclass of UserNotification.
Stefan Vogel <sv@exept.de>
parents: 7031
diff changeset
   214
    WarningSignal := Warning.
7035
1d049fb7ae5a Make UserInformation a class based exception
Stefan Vogel <sv@exept.de>
parents: 7033
diff changeset
   215
    InformationSignal := UserInformation.
8330
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
   216
    ActivityNotificationSignal := ActivityNotification.
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
   217
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
   218
    DeepCopyErrorSignal := DeepCopyError.
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
   219
6203
d39d75849383 class based exceptions - abortSignal
Claus Gittinger <cg@exept.de>
parents: 6199
diff changeset
   220
    AbortSignal := AbortOperationRequest.
6877
ab4e7d42f9f8 AbortAllOperation - now class based
Claus Gittinger <cg@exept.de>
parents: 6874
diff changeset
   221
    AbortAllSignal := AbortAllOperationRequest.
8330
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
   222
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
   223
    OSSignalInterruptSignal := OSSignalInterrupt.
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
   224
    RecursiveStoreStringSignal := RecursiveStoreError.
5971
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   225
5980
5fd29de6d596 more class based exceptions
Claus Gittinger <cg@exept.de>
parents: 5977
diff changeset
   226
    "
5fd29de6d596 more class based exceptions
Claus Gittinger <cg@exept.de>
parents: 5977
diff changeset
   227
     Object initSignals
5fd29de6d596 more class based exceptions
Claus Gittinger <cg@exept.de>
parents: 5977
diff changeset
   228
    "
5971
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   229
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   230
    "Modified: / 22.1.1998 / 21:23:40 / av"
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   231
    "Modified: / 4.8.1999 / 08:54:06 / stefan"
6203
d39d75849383 class based exceptions - abortSignal
Claus Gittinger <cg@exept.de>
parents: 6199
diff changeset
   232
    "Modified: / 16.11.2001 / 16:30:08 / cg"
5971
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   233
!
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   234
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   235
initialize
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   236
    "called only once - initialize signals"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   237
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   238
    ErrorSignal isNil ifTrue:[
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   239
        self initSignals
5971
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   240
    ].
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
    ObjectAttributes isNil ifTrue:[
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   243
        ObjectAttributes := WeakIdentityDictionary new.
5971
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   244
    ].
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   245
    Dependencies isNil ifTrue:[
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   246
        Dependencies := WeakDependencyDictionary new.
5971
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   247
    ].
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   248
    NonWeakDependencies isNil ifTrue:[
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   249
        NonWeakDependencies := IdentityDictionary new.
5971
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   250
    ].
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   251
    SynchronizationSemaphores isNil ifTrue:[
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   252
        SynchronizationSemaphores := WeakIdentityDictionary new.
5971
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   253
    ].
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   254
    FinalizationLobby isNil ifTrue:[
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   255
        FinalizationLobby := Registry new.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   256
    ].
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
    "/ initialize InfoPrinting to the VM's infoPrint setting
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   259
    "/ (which can be turned off via a command line argument)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   260
    InfoPrinting := ObjectMemory infoPrinting.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   261
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   262
    "Object initialize"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   263
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   264
    "Modified: / 22.1.1998 / 21:23:40 / av"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   265
    "Modified: / 3.2.1998 / 18:55:09 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   266
    "Modified: / 4.8.1999 / 08:54:06 / stefan"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   267
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   268
7303
98111fb6a285 category
Claus Gittinger <cg@exept.de>
parents: 7285
diff changeset
   269
!Object class methodsFor:'Compatibility-ST80'!
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   270
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   271
rootError
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   272
    "return the signal used for error/error: - handling.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   273
     Same as errorSignal for ST80 compatibility."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   274
7094
617eeaf2f8ba Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7081
diff changeset
   275
    ^ Error
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   276
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   277
    "Created: / 15.1.1998 / 23:47:05 / stefan"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   278
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   279
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   280
!Object class methodsFor:'Signal constants'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   281
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
   282
abortAllSignal
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   283
    "return the signal used to abort user actions (much like AbortSignal).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   284
     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
   285
     the loop (such as when confirming multiple class deletions etc.)"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   286
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   287
    ^ AbortAllSignal
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   288
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   289
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
   290
abortSignal
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   291
    "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
   292
     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
   293
     currently active doIt/printIt or inspectIt. (also some others use
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   294
     this for a save abort)"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   295
8521
60f0e479ffc1 use class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8502
diff changeset
   296
    ^ AbortOperationRequest
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   297
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   298
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   299
activityNotificationSignal
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   300
    "return the signal used for activity notifications.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   301
     A handler for this signal gets all #activityNotification: sends"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   302
8330
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
   303
    ^ ActivityNotification
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   304
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   305
13416
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
   306
ambiguousMessageSignal
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
   307
    "return the signal used for ambiguousMessage: - error handling"
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
   308
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
   309
    ^ AmbiguousMessage
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
   310
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
   311
    "Created: / 21-07-2010 / 15:39:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
   312
!
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
   313
11132
e5bd3a66ca80 conversion errors (specific error classes)
Claus Gittinger <cg@exept.de>
parents: 11068
diff changeset
   314
conversionErrorSignal
e5bd3a66ca80 conversion errors (specific error classes)
Claus Gittinger <cg@exept.de>
parents: 11068
diff changeset
   315
    "return the signal used for conversion error handling"
e5bd3a66ca80 conversion errors (specific error classes)
Claus Gittinger <cg@exept.de>
parents: 11068
diff changeset
   316
e5bd3a66ca80 conversion errors (specific error classes)
Claus Gittinger <cg@exept.de>
parents: 11068
diff changeset
   317
    ^ ConversionError
e5bd3a66ca80 conversion errors (specific error classes)
Claus Gittinger <cg@exept.de>
parents: 11068
diff changeset
   318
!
e5bd3a66ca80 conversion errors (specific error classes)
Claus Gittinger <cg@exept.de>
parents: 11068
diff changeset
   319
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
   320
deepCopyErrorSignal
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   321
    "return the signal raised when a deepcopy is asked for
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   322
     an object which cannot do this (for example, BlockClosures
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   323
     or Contexts)."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   324
8330
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
   325
    ^ DeepCopyError
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   326
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   327
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   328
elementOutOfBoundsSignal
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   329
    "return the signal used for element error reporting
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   330
     (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
   331
      be put into a bytearray)"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   332
8330
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
   333
    ^ ElementBoundsError
5755
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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   336
errorSignal
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   337
    "return the signal used for error/error: - handling"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   338
7094
617eeaf2f8ba Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7081
diff changeset
   339
    ^ Error
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   340
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   341
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   342
haltSignal
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   343
    "return the signal used for halt/halt: - handling"
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
    ^ HaltSignal
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   346
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   347
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   348
indexNotFoundSignal
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   349
    "return the signal used for bad index error reporting.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   350
     This is also the parentSignal of the nonIntegerIndex- and
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   351
     subscriptOutOfBoundsSignal"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   352
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   353
    ^ IndexNotFoundSignal
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   354
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   355
    "Created: / 8.11.1997 / 19:15:48 / cg"
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
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
   358
informationSignal
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
   359
    "return the signal used for informations.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   360
     A handler for this signal gets all #information: sends"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   361
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   362
    ^ InformationSignal
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   363
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   364
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   365
internalErrorSignal
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   366
    "return the signal used to report internal (VM-) errors."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   367
8330
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
   368
    ^ VMInternalError
5755
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
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
   371
keyNotFoundSignal
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   372
    "return the signal used for no such key error reporting"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   373
8330
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
   374
    ^ KeyNotFoundError
5755
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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   377
messageNotUnderstoodSignal
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   378
    "return the signal used for doesNotUnderstand: - error handling"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   379
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   380
    ^ MessageNotUnderstoodSignal
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   381
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   382
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
   383
nonIntegerIndexSignal
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   384
    "return the signal used for bad subscript error reporting"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   385
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   386
    ^ NonIntegerIndexSignal
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   387
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   388
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
   389
notFoundSignal
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   390
    "return the signal used for no element found error reporting"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   391
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   392
    ^ NotFoundSignal
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
7644
211762a9a39f added notifySignal for VW compatibility
Claus Gittinger <cg@exept.de>
parents: 7621
diff changeset
   395
notifySignal
211762a9a39f added notifySignal for VW compatibility
Claus Gittinger <cg@exept.de>
parents: 7621
diff changeset
   396
    "return the parent of all notification signals."
211762a9a39f added notifySignal for VW compatibility
Claus Gittinger <cg@exept.de>
parents: 7621
diff changeset
   397
211762a9a39f added notifySignal for VW compatibility
Claus Gittinger <cg@exept.de>
parents: 7621
diff changeset
   398
    ^ Notification
211762a9a39f added notifySignal for VW compatibility
Claus Gittinger <cg@exept.de>
parents: 7621
diff changeset
   399
!
211762a9a39f added notifySignal for VW compatibility
Claus Gittinger <cg@exept.de>
parents: 7621
diff changeset
   400
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
   401
osSignalInterruptSignal
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   402
    "return the signal used for OS-signal error reporting;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   403
     This is only raised if handled - otherwise, a debugger is entered."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   404
8330
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
   405
    ^ OSSignalInterrupt
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   406
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   407
    "Modified: / 12.6.1998 / 16:27:26 / cg"
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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   410
primitiveFailureSignal
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   411
    "return the signal used for primitiveFailed - error handling"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   412
8330
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
   413
    ^ PrimitiveFailure
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   414
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   415
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   416
privateMethodSignal
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   417
    "return the signal used for privateMethod - error handling"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   418
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   419
    ^ MessageNotUnderstoodSignal
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   420
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   421
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
   422
recursionInterruptSignal
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   423
    "return the signal used for recursion overflow error handling"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   424
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   425
    ^ RecursionInterruptSignal
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   426
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   427
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   428
recursiveStoreStringSignal
8330
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
   429
    "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
   430
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
   431
    ^ RecursiveStoreError
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
   432
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
   433
    "
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
   434
     RecursiveStoreError handle:[:ex |
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   435
        self halt
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   436
     ] do:[
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   437
        |a|
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   438
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   439
        a := Array new:1.
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   440
        a at:1 put:a.
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   441
        a storeOn:Transcript
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   442
     ]
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   443
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   444
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   445
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   446
     |a|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   447
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   448
     a := Array new:1.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   449
     a at:1 put:a.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   450
     a storeOn:Transcript
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   451
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   452
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   453
5980
5fd29de6d596 more class based exceptions
Claus Gittinger <cg@exept.de>
parents: 5977
diff changeset
   454
subclassResponsibilitySignal
5fd29de6d596 more class based exceptions
Claus Gittinger <cg@exept.de>
parents: 5977
diff changeset
   455
    "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
   456
     (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
   457
5fd29de6d596 more class based exceptions
Claus Gittinger <cg@exept.de>
parents: 5977
diff changeset
   458
    ^ SubclassResponsibilityError
5fd29de6d596 more class based exceptions
Claus Gittinger <cg@exept.de>
parents: 5977
diff changeset
   459
!
5fd29de6d596 more class based exceptions
Claus Gittinger <cg@exept.de>
parents: 5977
diff changeset
   460
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   461
subscriptOutOfBoundsSignal
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   462
    "return the signal used for subscript error reporting.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   463
     (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
   464
      index less than 1 or greater than the array size)"
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
    ^ SubscriptOutOfBoundsSignal
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
userInterruptSignal
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   470
    "return the signal used for ^C interrupts handling"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   471
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   472
    ^ UserInterruptSignal
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   473
!
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
userNotificationSignal
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   476
    "the parent signal used with information and warnings.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   477
     Handling this allows handling of both information- and warning notifications."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   478
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   479
    ^ UserNotificationSignal
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
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
   482
warningSignal
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   483
    "return the signal used for warnings.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   484
     A handler for this signal gets all #warn: sends"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   485
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   486
    ^ WarningSignal
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   487
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   488
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   489
!Object class methodsFor:'info messages'!
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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   492
    "return the flag which controls information messages."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   493
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   494
    ^ InfoPrinting
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   495
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   496
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   497
infoPrinting:aBoolean
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   498
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   499
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   500
    "turn on/off printing of information messages.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   501
     If the argument, aBoolean is false, infoPrint will not output
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   502
     messages. The default is true."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   503
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   504
    InfoPrinting := aBoolean
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
14478
4ff5aab56d26 more specific error reporting for type errors
Claus Gittinger <cg@exept.de>
parents: 14369
diff changeset
   507
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   508
!Object class methodsFor:'queries'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   509
8892
5d05a7f150a5 +isAbstract
Claus Gittinger <cg@exept.de>
parents: 8879
diff changeset
   510
isAbstract
11221
1e88faaa1249 comment
Claus Gittinger <cg@exept.de>
parents: 11161
diff changeset
   511
    "Return if this class is an abstract class.
1e88faaa1249 comment
Claus Gittinger <cg@exept.de>
parents: 11161
diff changeset
   512
     True is returned for Object here; false for subclasses.
1e88faaa1249 comment
Claus Gittinger <cg@exept.de>
parents: 11161
diff changeset
   513
     Abstract subclasses must redefine again."
1e88faaa1249 comment
Claus Gittinger <cg@exept.de>
parents: 11161
diff changeset
   514
8892
5d05a7f150a5 +isAbstract
Claus Gittinger <cg@exept.de>
parents: 8879
diff changeset
   515
    ^ self == Object
5d05a7f150a5 +isAbstract
Claus Gittinger <cg@exept.de>
parents: 8879
diff changeset
   516
!
5d05a7f150a5 +isAbstract
Claus Gittinger <cg@exept.de>
parents: 8879
diff changeset
   517
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   518
isBuiltInClass
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   519
    "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
   520
     i.e. you cannot add/remove instance variables without recompiling
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   521
     the VM.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   522
     Here, true is returned for myself, false for subclasses."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   523
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   524
    ^ self == Object
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   525
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   526
    "Modified: 23.4.1996 / 16:00:07 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   527
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   528
14296
fe82bc5091f9 added: #isUUID
Stefan Vogel <sv@exept.de>
parents: 14292
diff changeset
   529
fe82bc5091f9 added: #isUUID
Stefan Vogel <sv@exept.de>
parents: 14292
diff changeset
   530
fe82bc5091f9 added: #isUUID
Stefan Vogel <sv@exept.de>
parents: 14292
diff changeset
   531
8441
728c887f2532 Dolphin compatibility: #trigger...
Stefan Vogel <sv@exept.de>
parents: 8426
diff changeset
   532
!Object methodsFor:'Compatibility-Dolphin'!
728c887f2532 Dolphin compatibility: #trigger...
Stefan Vogel <sv@exept.de>
parents: 8426
diff changeset
   533
11161
3888d6f4e6f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11142
diff changeset
   534
stbFixup: anSTBInFiler at: newObjectIndex
3888d6f4e6f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11142
diff changeset
   535
    "Answer the true object that must be used to represent the receiver when read from anSTBInFiler.
3888d6f4e6f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11142
diff changeset
   536
     Typically this is overridden by subclasses of STBProxy to answer the proxied object. Other classes
3888d6f4e6f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11142
diff changeset
   537
     may also override this method to effectively 'one way become' the receiver to some other object"
3888d6f4e6f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11142
diff changeset
   538
3888d6f4e6f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11142
diff changeset
   539
    ^ self
3888d6f4e6f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11142
diff changeset
   540
!
3888d6f4e6f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11142
diff changeset
   541
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
   542
trigger:anAspect
8441
728c887f2532 Dolphin compatibility: #trigger...
Stefan Vogel <sv@exept.de>
parents: 8426
diff changeset
   543
    self changed:anAspect
728c887f2532 Dolphin compatibility: #trigger...
Stefan Vogel <sv@exept.de>
parents: 8426
diff changeset
   544
!
728c887f2532 Dolphin compatibility: #trigger...
Stefan Vogel <sv@exept.de>
parents: 8426
diff changeset
   545
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
   546
trigger:anAspect with:anArgument
8441
728c887f2532 Dolphin compatibility: #trigger...
Stefan Vogel <sv@exept.de>
parents: 8426
diff changeset
   547
    self changed:anAspect with:anArgument
728c887f2532 Dolphin compatibility: #trigger...
Stefan Vogel <sv@exept.de>
parents: 8426
diff changeset
   548
!
728c887f2532 Dolphin compatibility: #trigger...
Stefan Vogel <sv@exept.de>
parents: 8426
diff changeset
   549
728c887f2532 Dolphin compatibility: #trigger...
Stefan Vogel <sv@exept.de>
parents: 8426
diff changeset
   550
when:anAspect sendTo:anObject
728c887f2532 Dolphin compatibility: #trigger...
Stefan Vogel <sv@exept.de>
parents: 8426
diff changeset
   551
    self expressInterestIn:anAspect for:anObject sendBack:anAspect
728c887f2532 Dolphin compatibility: #trigger...
Stefan Vogel <sv@exept.de>
parents: 8426
diff changeset
   552
! !
728c887f2532 Dolphin compatibility: #trigger...
Stefan Vogel <sv@exept.de>
parents: 8426
diff changeset
   553
9375
6cbc697095e7 Felix 6/15/2006
fm
parents: 9335
diff changeset
   554
!Object methodsFor:'Compatibility-ST/V'!
6cbc697095e7 Felix 6/15/2006
fm
parents: 9335
diff changeset
   555
6cbc697095e7 Felix 6/15/2006
fm
parents: 9335
diff changeset
   556
triggerEvent:aSymbol
6cbc697095e7 Felix 6/15/2006
fm
parents: 9335
diff changeset
   557
    self changed:aSymbol
6cbc697095e7 Felix 6/15/2006
fm
parents: 9335
diff changeset
   558
! !
6cbc697095e7 Felix 6/15/2006
fm
parents: 9335
diff changeset
   559
7261
f35fc9cee675 method category rename
Claus Gittinger <cg@exept.de>
parents: 7216
diff changeset
   560
!Object methodsFor:'Compatibility-ST80'!
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   561
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   562
isMetaclass
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   563
    ^ self isMeta
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   564
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   565
7261
f35fc9cee675 method category rename
Claus Gittinger <cg@exept.de>
parents: 7216
diff changeset
   566
!Object methodsFor:'Compatibility-Squeak'!
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   567
9071
e7d44f6f017a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9005
diff changeset
   568
becomeForward:anotherObject
e7d44f6f017a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9005
diff changeset
   569
    self becomeSameAs:anotherObject
e7d44f6f017a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9005
diff changeset
   570
!
e7d44f6f017a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9005
diff changeset
   571
e7d44f6f017a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9005
diff changeset
   572
becomeForward:anotherObject copyHash:copyHash
e7d44f6f017a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9005
diff changeset
   573
    copyHash ifTrue:[ self error:'unsupported operation' ].
e7d44f6f017a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9005
diff changeset
   574
    self becomeSameAs:anotherObject
e7d44f6f017a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9005
diff changeset
   575
!
e7d44f6f017a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9005
diff changeset
   576
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   577
clone
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   578
    ^ self shallowCopy
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   579
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   580
6146
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   581
copyTwoLevel
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   582
    "one more level than a shallowCopy"
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   583
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   584
    ^ self copyToLevel:2
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   585
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   586
    "
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   587
     |original copy elL1 elL2 elL3 copyOfElL1|
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   588
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   589
     original := Array new:3.
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   590
     original at:1 put:1234.
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   591
     original at:2 put:'hello'.
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   592
     original at:3 put:(elL1 := Array new:3).
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   593
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   594
     elL1 at:1 put:1234.
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   595
     elL1 at:2 put:'hello'.
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   596
     elL1 at:3 put:(elL2 := Array new:3).
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   597
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   598
     elL2 at:1 put:1234.
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   599
     elL2 at:2 put:'hello'.
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   600
     elL2 at:3 put:(elL3 := Array new:3).
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   601
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   602
     elL3 at:1 put:1234.
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   603
     elL3 at:2 put:'hello'.
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   604
     elL3 at:3 put:(Array new:3).
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   605
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   606
     copy := original copyTwoLevel.
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   607
     (original at:2) ~~ (copy at:2) ifFalse:[self halt].
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   608
     (original at:3) ~~ (copy at:3) ifFalse:[self halt].
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   609
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   610
     copyOfElL1 := copy at:3.
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   611
     (elL1 at:2) == (copyOfElL1 at:2) ifFalse:[self halt].
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   612
     (elL1 at:3) == (copyOfElL1 at:3) ifFalse:[self halt].
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   613
    "
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   614
!
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   615
7320
0d5b4de4045a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7303
diff changeset
   616
explore
0d5b4de4045a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7303
diff changeset
   617
    (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
   618
    ifTrue:[
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   619
        self inspect
7320
0d5b4de4045a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7303
diff changeset
   620
    ]
0d5b4de4045a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7303
diff changeset
   621
!
0d5b4de4045a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7303
diff changeset
   622
12285
54773840f621 added: #inform: - squeak compatibility
Claus Gittinger <cg@exept.de>
parents: 12158
diff changeset
   623
inform: aString
54773840f621 added: #inform: - squeak compatibility
Claus Gittinger <cg@exept.de>
parents: 12158
diff changeset
   624
    "Display a message for the user to read and then dismiss."
54773840f621 added: #inform: - squeak compatibility
Claus Gittinger <cg@exept.de>
parents: 12158
diff changeset
   625
54773840f621 added: #inform: - squeak compatibility
Claus Gittinger <cg@exept.de>
parents: 12158
diff changeset
   626
    self information:aString
54773840f621 added: #inform: - squeak compatibility
Claus Gittinger <cg@exept.de>
parents: 12158
diff changeset
   627
!
54773840f621 added: #inform: - squeak compatibility
Claus Gittinger <cg@exept.de>
parents: 12158
diff changeset
   628
9335
2dcbf8f91693 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9314
diff changeset
   629
isInMemory
2dcbf8f91693 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9314
diff changeset
   630
    "All normal objects are."
2dcbf8f91693 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9314
diff changeset
   631
2dcbf8f91693 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9314
diff changeset
   632
    ^ true
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
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   635
stringForReadout
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   636
        ^ self stringRepresentation
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   637
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   638
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   639
stringRepresentation
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   640
        "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"
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   641
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   642
        ^ self printString
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
9146
56176a7bf685 +valueWithPossibleArguments:
Claus Gittinger <cg@exept.de>
parents: 9105
diff changeset
   645
valueWithPossibleArguments:argArray
56176a7bf685 +valueWithPossibleArguments:
Claus Gittinger <cg@exept.de>
parents: 9105
diff changeset
   646
     ^ self
56176a7bf685 +valueWithPossibleArguments:
Claus Gittinger <cg@exept.de>
parents: 9105
diff changeset
   647
!
56176a7bf685 +valueWithPossibleArguments:
Claus Gittinger <cg@exept.de>
parents: 9105
diff changeset
   648
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   649
veryDeepCopy
8383
dea5311899c5 comments in copy methods
Claus Gittinger <cg@exept.de>
parents: 8377
diff changeset
   650
     ^ self deepCopyUsing:(IdentityDictionary new)
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   651
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   652
7567
1c1a49b3ebf0 compatibility
Claus Gittinger <cg@exept.de>
parents: 7566
diff changeset
   653
!Object methodsFor:'Compatibility-VW'!
1c1a49b3ebf0 compatibility
Claus Gittinger <cg@exept.de>
parents: 7566
diff changeset
   654
8637
e7e695f53819 *** empty log message ***
penk
parents: 8632
diff changeset
   655
isCharacters
e7e695f53819 *** empty log message ***
penk
parents: 8632
diff changeset
   656
    "added for visual works compatibility"
e7e695f53819 *** empty log message ***
penk
parents: 8632
diff changeset
   657
    ^ false
e7e695f53819 *** empty log message ***
penk
parents: 8632
diff changeset
   658
!
e7e695f53819 *** empty log message ***
penk
parents: 8632
diff changeset
   659
7567
1c1a49b3ebf0 compatibility
Claus Gittinger <cg@exept.de>
parents: 7566
diff changeset
   660
keyNotFoundError:aKey
1c1a49b3ebf0 compatibility
Claus Gittinger <cg@exept.de>
parents: 7566
diff changeset
   661
    "VW compatibility"
1c1a49b3ebf0 compatibility
Claus Gittinger <cg@exept.de>
parents: 7566
diff changeset
   662
1c1a49b3ebf0 compatibility
Claus Gittinger <cg@exept.de>
parents: 7566
diff changeset
   663
    self errorKeyNotFound:aKey.
1c1a49b3ebf0 compatibility
Claus Gittinger <cg@exept.de>
parents: 7566
diff changeset
   664
!
1c1a49b3ebf0 compatibility
Claus Gittinger <cg@exept.de>
parents: 7566
diff changeset
   665
1c1a49b3ebf0 compatibility
Claus Gittinger <cg@exept.de>
parents: 7566
diff changeset
   666
oneWayBecome:anotherObject
1c1a49b3ebf0 compatibility
Claus Gittinger <cg@exept.de>
parents: 7566
diff changeset
   667
    ^ self becomeSameAs:anotherObject
1c1a49b3ebf0 compatibility
Claus Gittinger <cg@exept.de>
parents: 7566
diff changeset
   668
1c1a49b3ebf0 compatibility
Claus Gittinger <cg@exept.de>
parents: 7566
diff changeset
   669
    "
1c1a49b3ebf0 compatibility
Claus Gittinger <cg@exept.de>
parents: 7566
diff changeset
   670
     |arr o1 o2|
1c1a49b3ebf0 compatibility
Claus Gittinger <cg@exept.de>
parents: 7566
diff changeset
   671
1c1a49b3ebf0 compatibility
Claus Gittinger <cg@exept.de>
parents: 7566
diff changeset
   672
     arr := Array new:2.
1c1a49b3ebf0 compatibility
Claus Gittinger <cg@exept.de>
parents: 7566
diff changeset
   673
     arr at:1 put:(o1 := Object new).
1c1a49b3ebf0 compatibility
Claus Gittinger <cg@exept.de>
parents: 7566
diff changeset
   674
     arr at:2 put:(o2 := Point new).
1c1a49b3ebf0 compatibility
Claus Gittinger <cg@exept.de>
parents: 7566
diff changeset
   675
     o1 oneWayBecome:o2.
1c1a49b3ebf0 compatibility
Claus Gittinger <cg@exept.de>
parents: 7566
diff changeset
   676
     (arr at:1) ~~ o2 ifTrue:[self halt].
1c1a49b3ebf0 compatibility
Claus Gittinger <cg@exept.de>
parents: 7566
diff changeset
   677
    "
1c1a49b3ebf0 compatibility
Claus Gittinger <cg@exept.de>
parents: 7566
diff changeset
   678
    "
1c1a49b3ebf0 compatibility
Claus Gittinger <cg@exept.de>
parents: 7566
diff changeset
   679
     |arr o1 o2|
1c1a49b3ebf0 compatibility
Claus Gittinger <cg@exept.de>
parents: 7566
diff changeset
   680
1c1a49b3ebf0 compatibility
Claus Gittinger <cg@exept.de>
parents: 7566
diff changeset
   681
     arr := Array new:2.
1c1a49b3ebf0 compatibility
Claus Gittinger <cg@exept.de>
parents: 7566
diff changeset
   682
     arr at:1 put:(o1 := Object new).
1c1a49b3ebf0 compatibility
Claus Gittinger <cg@exept.de>
parents: 7566
diff changeset
   683
     arr at:2 put:(o2 := Point new).
1c1a49b3ebf0 compatibility
Claus Gittinger <cg@exept.de>
parents: 7566
diff changeset
   684
     o1 becomeSameAs:o2.
1c1a49b3ebf0 compatibility
Claus Gittinger <cg@exept.de>
parents: 7566
diff changeset
   685
     (arr at:1) ~~ o2 ifTrue:[self halt].
1c1a49b3ebf0 compatibility
Claus Gittinger <cg@exept.de>
parents: 7566
diff changeset
   686
    "
1c1a49b3ebf0 compatibility
Claus Gittinger <cg@exept.de>
parents: 7566
diff changeset
   687
! !
1c1a49b3ebf0 compatibility
Claus Gittinger <cg@exept.de>
parents: 7566
diff changeset
   688
14296
fe82bc5091f9 added: #isUUID
Stefan Vogel <sv@exept.de>
parents: 14292
diff changeset
   689
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   690
!Object methodsFor:'accessing'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   691
13320
Claus Gittinger <cg@exept.de>
parents: 13261
diff changeset
   692
_at:index
Claus Gittinger <cg@exept.de>
parents: 13261
diff changeset
   693
    "experimental:
Claus Gittinger <cg@exept.de>
parents: 13261
diff changeset
   694
     this is a synthetic selector, generated by the compiler,
Claus Gittinger <cg@exept.de>
parents: 13261
diff changeset
   695
     if a construct of the form expr[idx...] is parsed.
Claus Gittinger <cg@exept.de>
parents: 13261
diff changeset
   696
     I.e.
Claus Gittinger <cg@exept.de>
parents: 13261
diff changeset
   697
        v[n]
Claus Gittinger <cg@exept.de>
parents: 13261
diff changeset
   698
     generates
Claus Gittinger <cg@exept.de>
parents: 13261
diff changeset
   699
        v _at: n
Claus Gittinger <cg@exept.de>
parents: 13261
diff changeset
   700
    "
Claus Gittinger <cg@exept.de>
parents: 13261
diff changeset
   701
Claus Gittinger <cg@exept.de>
parents: 13261
diff changeset
   702
    ^ self at:index
Claus Gittinger <cg@exept.de>
parents: 13261
diff changeset
   703
Claus Gittinger <cg@exept.de>
parents: 13261
diff changeset
   704
    "Created: / 21-03-2011 / 14:07:57 / cg"
Claus Gittinger <cg@exept.de>
parents: 13261
diff changeset
   705
!
Claus Gittinger <cg@exept.de>
parents: 13261
diff changeset
   706
Claus Gittinger <cg@exept.de>
parents: 13261
diff changeset
   707
_at:index put:value
Claus Gittinger <cg@exept.de>
parents: 13261
diff changeset
   708
    "experimental:
Claus Gittinger <cg@exept.de>
parents: 13261
diff changeset
   709
     this is a synthetic selector, generated by the compiler,
Claus Gittinger <cg@exept.de>
parents: 13261
diff changeset
   710
     if a construct of the form expr[idx...] is parsed.
Claus Gittinger <cg@exept.de>
parents: 13261
diff changeset
   711
     I.e.
Claus Gittinger <cg@exept.de>
parents: 13261
diff changeset
   712
        v[n]
Claus Gittinger <cg@exept.de>
parents: 13261
diff changeset
   713
     generates
Claus Gittinger <cg@exept.de>
parents: 13261
diff changeset
   714
        v _at: n
Claus Gittinger <cg@exept.de>
parents: 13261
diff changeset
   715
    "
Claus Gittinger <cg@exept.de>
parents: 13261
diff changeset
   716
Claus Gittinger <cg@exept.de>
parents: 13261
diff changeset
   717
    ^ self at:index put:value
Claus Gittinger <cg@exept.de>
parents: 13261
diff changeset
   718
Claus Gittinger <cg@exept.de>
parents: 13261
diff changeset
   719
    "Created: / 21-03-2011 / 14:10:12 / cg"
Claus Gittinger <cg@exept.de>
parents: 13261
diff changeset
   720
!
Claus Gittinger <cg@exept.de>
parents: 13261
diff changeset
   721
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   722
at:index
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   723
    "return the indexed instance variable with index, anInteger;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   724
     this method can be redefined in subclasses."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   725
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   726
    ^ self basicAt:index
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   727
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   728
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   729
at:index put:anObject
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   730
    "store the 2nd arg, anObject as indexed instvar with index, anInteger.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   731
     this method can be redefined in subclasses. Returns anObject (sigh)"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   732
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   733
    ^ self basicAt:index put:anObject
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   734
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   735
    "Modified: 19.4.1996 / 11:13:29 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   736
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   737
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   738
basicAt:index
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   739
    "return the indexed instance variable with index, anInteger.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   740
     Trigger an error if the receiver has no indexed instance variables.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   741
     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
   742
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   743
%{  /* NOCONTEXT */
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   744
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   745
    REGISTER int nbytes, indx;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   746
    OBJ myClass;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   747
    REGISTER char *pFirst;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   748
    REGISTER int n;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   749
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   750
    /*
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   751
     * notice the missing test for self being a nonNilObject -
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   752
     * this can be done since basicAt: is defined both in UndefinedObject
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   753
     * and SmallInteger
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   754
     */
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   755
    if (__isSmallInteger(index)) {
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   756
        myClass = __qClass(self);
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   757
        indx = __intVal(index) - 1;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   758
        n /* nInstVars */ = __intVal(__ClassInstPtr(myClass)->c_ninstvars);
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   759
        n /* nInstBytes */ = OHDR_SIZE + __OBJS2BYTES__(n /* nInstVars */);
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   760
        nbytes = __qSize(self) - n /* nInstBytes */;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   761
        pFirst = (char *)(__InstPtr(self)) + n /* nInstBytes */;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   762
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   763
        switch ((INT)(__ClassInstPtr(myClass)->c_flags) & __MASKSMALLINT(ARRAYMASK)) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   764
            case __MASKSMALLINT(POINTERARRAY):
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   765
            case __MASKSMALLINT(WKPOINTERARRAY):
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   766
                /*
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   767
                 * pointers
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   768
                 */
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   769
                if ((unsigned)indx < (__BYTES2OBJS__(nbytes))) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   770
                    OBJ *op;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   771
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   772
                    op = (OBJ *)pFirst + indx;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   773
                    RETURN ( *op );
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   774
                }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   775
                break;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   776
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   777
            case __MASKSMALLINT(BYTEARRAY):
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   778
                /*
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   779
                 * (unsigned) bytes
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   780
                 */
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   781
                if ((unsigned)indx < nbytes) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   782
                    unsigned char *cp;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   783
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   784
                    cp = (unsigned char *)pFirst + indx;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   785
                    RETURN ( __mkSmallInteger( (*cp & 0xFF)) );
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   786
                }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   787
                break;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   788
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   789
            case __MASKSMALLINT(FLOATARRAY):
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   790
                /*
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   791
                 * native floats
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   792
                 */
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   793
                if ((unsigned)indx < (nbytes / sizeof(float))) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   794
                    float *fp;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   795
                    float f;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   796
                    OBJ v;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   797
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   798
                    fp = (float *)pFirst + indx;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   799
                    f = *fp;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   800
                    if (f == 0.0) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   801
                        v = __float0;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   802
                    } else {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   803
                        __qMKSFLOAT(v, f);
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   804
                    }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   805
                    RETURN (v);
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   806
                }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   807
                break;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   808
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   809
            case __MASKSMALLINT(DOUBLEARRAY):
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   810
                /*
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   811
                 * native doubles
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   812
                 */
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   813
#ifdef __NEED_DOUBLE_ALIGN
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   814
                if ((INT)pFirst & (__DOUBLE_ALIGN-1)) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   815
                    int delta = __DOUBLE_ALIGN - ((INT)pFirst & (__DOUBLE_ALIGN-1));
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   816
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   817
                    pFirst += delta;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   818
                    nbytes -= delta;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   819
                }
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   820
#endif
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   821
                if ((unsigned)indx < (nbytes / sizeof(double))) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   822
                    double *dp;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   823
                    double d;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   824
                    OBJ v;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   825
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   826
                    dp = (double *)pFirst + indx;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   827
                    d = *dp;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   828
                    if (d == 0.0) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   829
                        v = __float0;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   830
                    } else {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   831
                        __qMKFLOAT(v, d);
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   832
                    }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   833
                    RETURN (v);
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   834
                }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   835
                break;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   836
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   837
            case __MASKSMALLINT(WORDARRAY):
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   838
                /*
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   839
                 * unsigned 16bit ints
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   840
                 */
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   841
                /* Notice: the hard coded shifts are by purpose;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   842
                 * it makes us independent of the short-size of the machine
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   843
                 */
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   844
                if ((unsigned)indx < (nbytes>>1)) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   845
                    unsigned short *sp;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   846
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   847
                    sp = (unsigned short *)(pFirst + (indx<<1));
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   848
                    RETURN ( __mkSmallInteger( (*sp & 0xFFFF)) );
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   849
                }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   850
                break;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   851
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   852
            case __MASKSMALLINT(SWORDARRAY):
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   853
                /*
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   854
                 * signed 16bit ints
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   855
                 */
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   856
                /* Notice: the hard coded shifts are by purpose;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   857
                 * it makes us independent of the short-size of the machine
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   858
                 */
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   859
                if ((unsigned)indx < (nbytes>>1)) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   860
                    short *ssp;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   861
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   862
                    ssp = (short *)(pFirst + (indx<<1));
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   863
                    RETURN ( __mkSmallInteger( (*ssp) ));
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   864
                }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   865
                break;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   866
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   867
            case __MASKSMALLINT(LONGARRAY):
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   868
                /*
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   869
                 * unsigned 32bit ints
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   870
                 */
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   871
                /* Notice: the hard coded shifts are by purpose;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   872
                 * it makes us independent of the int-size of the machine
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   873
                 */
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   874
                if ((unsigned)indx < (nbytes>>2)) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   875
                    unsigned int32 ul;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   876
                    unsigned int32 *lp;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   877
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   878
                    lp = (unsigned int32 *)(pFirst + (indx<<2));
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   879
                    ul = *lp;
8901
824a89d0b5c7 alpha64 vs. POINTER_SIZE cleanup
Claus Gittinger <cg@exept.de>
parents: 8892
diff changeset
   880
#if __POINTER_SIZE__ == 8
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   881
                    {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   882
                        unsigned  INT ull = (unsigned INT)ul;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   883
                        RETURN ( __mkSmallInteger(ull) );
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   884
                    }
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   885
#else
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   886
                    if (ul <= _MAX_INT) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   887
                        RETURN ( __mkSmallInteger(ul) );
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   888
                    }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   889
                    RETURN ( __MKULARGEINT(ul) );
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   890
#endif
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   891
                }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   892
                break;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   893
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   894
            case __MASKSMALLINT(SLONGARRAY):
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   895
                /*
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   896
                 * signed 32bit ints
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   897
                 */
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   898
                /* Notice: the hard coded shifts are by purpose;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   899
                 * it makes us independent of the int-size of the machine
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   900
                 */
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   901
                if ((unsigned)indx < (nbytes>>2)) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   902
                    int32 *slp;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   903
                    int32 l;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   904
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   905
                    slp = (int32 *)(pFirst + (indx<<2));
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   906
                    l = *slp;
8901
824a89d0b5c7 alpha64 vs. POINTER_SIZE cleanup
Claus Gittinger <cg@exept.de>
parents: 8892
diff changeset
   907
#if __POINTER_SIZE__ == 8
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   908
                    {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   909
                        INT ll = (INT)l;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   910
                        RETURN ( __mkSmallInteger(ll) );
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   911
                    }
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   912
#else
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   913
                    if (__ISVALIDINTEGER(l)) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   914
                        RETURN ( __mkSmallInteger(l) );
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   915
                    }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   916
                    RETURN ( __MKLARGEINT(l) );
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   917
#endif
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   918
                }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   919
                break;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   920
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   921
            case __MASKSMALLINT(SLONGLONGARRAY):
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   922
                /*
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   923
                 * signed 64bit longlongs
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   924
                 */
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   925
#ifdef __NEED_LONGLONG_ALIGN
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   926
                if ((INT)pFirst & (__LONGLONG_ALIGN-1)) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   927
                    int delta = __LONGLONG_ALIGN - ((INT)pFirst & (__LONGLONG_ALIGN-1));
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   928
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   929
                    pFirst += delta;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   930
                    nbytes -= delta;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   931
                }
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   932
#endif
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   933
                /* Notice: the hard coded shifts are by purpose;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   934
                 * it makes us independent of the long/longlong-size of the machine
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   935
                 */
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   936
                if ((unsigned)indx < (nbytes>>3)) {
8901
824a89d0b5c7 alpha64 vs. POINTER_SIZE cleanup
Claus Gittinger <cg@exept.de>
parents: 8892
diff changeset
   937
#if __POINTER_SIZE__ == 8
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   938
                    INT *slp, ll;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   939
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   940
                    slp = (INT *)(pFirst + (indx<<3));
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   941
                    ll = *slp;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   942
                    if (__ISVALIDINTEGER(ll)) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   943
                        RETURN ( __mkSmallInteger(ll) );
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   944
                    }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   945
                    RETURN ( __MKLARGEINT(ll) );
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   946
#else
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   947
                    __int64__ *llp;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   948
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   949
                    llp = (__int64__ *)(pFirst + (indx<<3));
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   950
                    RETURN (__MKINT64(llp));
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   951
#endif
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   952
                }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   953
                break;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   954
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   955
            case __MASKSMALLINT(LONGLONGARRAY):
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   956
                /*
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   957
                 * unsigned 64bit longlongs
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   958
                 */
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   959
#ifdef __NEED_LONGLONG_ALIGN
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   960
                if ((INT)pFirst & (__LONGLONG_ALIGN-1)) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   961
                    int delta = __LONGLONG_ALIGN - ((INT)pFirst & (__LONGLONG_ALIGN-1));
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   962
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   963
                    pFirst += delta;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   964
                    nbytes -= delta;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   965
                }
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   966
#endif
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   967
                /* Notice: the hard coded shifts are by purpose;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   968
                 * it makes us independent of the long/longlong-size of the machine
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   969
                 */
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   970
                if ((unsigned)indx < (nbytes>>3)) {
8901
824a89d0b5c7 alpha64 vs. POINTER_SIZE cleanup
Claus Gittinger <cg@exept.de>
parents: 8892
diff changeset
   971
#if __POINTER_SIZE__ == 8
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   972
                    unsigned INT *ulp, ul;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   973
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   974
                    ulp = (unsigned INT *)(pFirst + (indx<<3));
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   975
                    ul = *ulp;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   976
                    if (ul <= _MAX_INT) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   977
                        RETURN ( __mkSmallInteger(ul) );
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   978
                    }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   979
                    RETURN ( __MKULARGEINT(ul) );
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   980
#else
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   981
                    __uint64__ *llp;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   982
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   983
                    llp = (__uint64__ *)(pFirst + (indx<<3));
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   984
                    RETURN (__MKUINT64(llp));
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   985
#endif
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   986
                }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   987
                break;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
   988
        }
5755
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
%}.
7216
59bfa2ffdcf7 utility
Claus Gittinger <cg@exept.de>
parents: 7215
diff changeset
   991
    ^ self indexNotIntegerOrOutOfBounds:index
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   992
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   993
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   994
basicAt:index put:anObject
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   995
    "store the 2nd arg, anObject as indexed instvar with index, anInteger.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   996
     Returns anObject (sigh).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   997
     Trigger an error if the receiver has no indexed instance variables.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   998
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   999
     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
  1000
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1001
%{  /* NOCONTEXT */
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1002
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1003
    register int nbytes, indx;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1004
    OBJ myClass;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1005
    register char *pFirst;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1006
/*    int nInstBytes, ninstvars, flags; */
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1007
    REGISTER int n;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1008
    unsigned int u;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1009
    int val;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1010
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1011
    /* notice the missing test for self being a nonNilObject -
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1012
       this can be done since basicAt: is defined both in UndefinedObject
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1013
       and SmallInteger */
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1014
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1015
    if (__isSmallInteger(index)) {
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1016
        indx = __intVal(index) - 1;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1017
        myClass = __qClass(self);
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1018
        n /* ninstvars */ = __intVal(__ClassInstPtr(myClass)->c_ninstvars);
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1019
        n /* nInstBytes */ = OHDR_SIZE + __OBJS2BYTES__(n /* ninstvars */);
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1020
        nbytes = __qSize(self) - n /* nInstBytes */;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1021
        pFirst = (char *)(__InstPtr(self)) + n /* nInstBytes */;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1022
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1023
        switch ((INT)(__ClassInstPtr(myClass)->c_flags) & __MASKSMALLINT(ARRAYMASK)) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1024
            case __MASKSMALLINT(POINTERARRAY):
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1025
            case __MASKSMALLINT(WKPOINTERARRAY):
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1026
                if ((unsigned)indx < (__BYTES2OBJS__(nbytes))) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1027
                    OBJ *op;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1028
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1029
                    op = (OBJ *)pFirst + indx;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1030
                    *op = anObject;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1031
                    __STORE(self, anObject);
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1032
                    RETURN ( anObject );
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1033
                }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1034
                break;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1035
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1036
            case __MASKSMALLINT(BYTEARRAY):
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1037
                if (__isSmallInteger(anObject)) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1038
                    val = __intVal(anObject);
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1039
                    if ((val & ~0xFF) == 0 /* i.e. (val >= 0) && (val <= 255) */) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1040
                        if ((unsigned)indx < nbytes) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1041
                            char *cp;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1042
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1043
                            cp = pFirst + indx;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1044
                            *cp = val;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1045
                            RETURN ( anObject );
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1046
                        }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1047
                    }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1048
                }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1049
                break;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1050
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1051
            case __MASKSMALLINT(FLOATARRAY):
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1052
                if ((unsigned)indx < (nbytes / sizeof(float))) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1053
                    float *fp;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1054
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1055
                    fp = (float *)pFirst + indx;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1056
                    if (anObject != nil) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1057
                        if (! __isSmallInteger(anObject)) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1058
                            if (__qIsFloatLike(anObject)) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1059
                                *fp = (float)(__floatVal(anObject));
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1060
                                RETURN ( anObject );
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1061
                            }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1062
                            if (__qIsShortFloat(anObject)) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1063
                                *fp = __shortFloatVal(anObject);
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1064
                                RETURN ( anObject );
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1065
                            }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1066
                        } else {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1067
                            *fp = (float) __intVal(anObject);
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1068
                            RETURN ( anObject );
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1069
                        }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1070
                    }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1071
                }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1072
                break;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1073
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1074
            case __MASKSMALLINT(DOUBLEARRAY):
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1075
#ifdef __NEED_DOUBLE_ALIGN
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1076
                if ((INT)pFirst & (__DOUBLE_ALIGN-1)) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1077
                    int delta = __DOUBLE_ALIGN - ((INT)pFirst & (__DOUBLE_ALIGN-1));
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1078
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1079
                    pFirst += delta;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1080
                    nbytes -= delta;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1081
                }
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1082
#endif
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1083
                if ((unsigned)indx < (nbytes / sizeof(double))) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1084
                    double *dp;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1085
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1086
                    dp = (double *)pFirst + indx;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1087
                    if (anObject != nil) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1088
                        if (! __isSmallInteger(anObject)) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1089
                            if (__qIsFloatLike(anObject)) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1090
                                *dp = __floatVal(anObject);
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1091
                                RETURN ( anObject );
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1092
                            }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1093
                            if (__qIsShortFloat(anObject)) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1094
                                *dp = (double)__shortFloatVal(anObject);
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1095
                                RETURN ( anObject );
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1096
                            }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1097
                        } else {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1098
                            *dp = (double) __intVal(anObject);
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1099
                            RETURN ( anObject );
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1100
                        }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1101
                    }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1102
                }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1103
                break;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1104
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1105
            case __MASKSMALLINT(WORDARRAY):
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1106
                if (__isSmallInteger(anObject)) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1107
                    val = __intVal(anObject);
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1108
                    if ((unsigned)val <= 0xFFFF) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1109
                        if ((unsigned)indx < (nbytes>>1)) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1110
                            unsigned short *sp;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1111
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1112
                            sp = (unsigned short *)(pFirst + (indx<<1));
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1113
                            *sp = val;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1114
                            RETURN ( anObject );
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1115
                        }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1116
                    }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1117
                }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1118
                break;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1119
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1120
            case __MASKSMALLINT(SWORDARRAY):
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1121
                if (__isSmallInteger(anObject)) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1122
                    val = __intVal(anObject);
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1123
                    if ((val >= -32768) && (val < 32768)) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1124
                        if ((unsigned)indx < (nbytes>>1)) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1125
                            short *ssp;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1126
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1127
                            ssp = (short *)(pFirst + (indx<<1));
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1128
                            *ssp = val;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1129
                            RETURN ( anObject );
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1130
                        }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1131
                    }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1132
                }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1133
                break;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1134
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1135
            case __MASKSMALLINT(SLONGARRAY):
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1136
                if ((unsigned)indx < (nbytes>>2)) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1137
                    int32 *slp;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1138
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1139
                    slp = (int32 *)(pFirst + (indx<<2));
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1140
                    if (__isSmallInteger(anObject)) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1141
                        *slp = __intVal(anObject);
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1142
                        RETURN ( anObject );
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1143
                    }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1144
                    n = __signedLongIntVal(anObject);
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1145
                    /*
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1146
                     * zero means failure for an int larger than 4 bytes
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1147
                     * (would be a smallInteger)
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1148
                     */
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1149
                    if (n) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1150
                        *slp = n;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1151
                        RETURN ( anObject );
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1152
                    }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1153
                }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1154
                break;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1155
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1156
            case __MASKSMALLINT(LONGARRAY):
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1157
                if ((unsigned)indx < (nbytes>>2)) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1158
                    unsigned int32 *lp;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1159
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1160
                    lp = (unsigned int32 *)(pFirst + (indx<<2));
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1161
                    if (anObject == __mkSmallInteger(0)) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1162
                        *lp = 0;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1163
                        RETURN ( anObject );
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1164
                    }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1165
                    u = __longIntVal(anObject);
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1166
                    /*
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1167
                     * zero means failure for an int larger than 4 bytes
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1168
                     * (would be a smallInteger)
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1169
                     */
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1170
                    if (u) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1171
                        *lp = u;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1172
                        RETURN ( anObject );
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1173
                    }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1174
                }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1175
                break;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1176
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1177
            case __MASKSMALLINT(SLONGLONGARRAY):
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1178
#ifdef __NEED_LONGLONG_ALIGN
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1179
                if ((INT)pFirst & (__LONGLONG_ALIGN-1)) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1180
                    int delta = __LONGLONG_ALIGN - ((INT)pFirst & (__LONGLONG_ALIGN-1));
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1181
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1182
                    pFirst += delta;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1183
                    nbytes -= delta;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1184
                }
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1185
#endif
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1186
                if ((unsigned)indx < (nbytes>>3)) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1187
                    __int64__ ll;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1188
                    __int64__ *sllp;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1189
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1190
                    sllp = (__int64__ *)(pFirst + (indx<<3));
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1191
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1192
                    if (anObject == __mkSmallInteger(0)) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1193
                        ll.lo = ll.hi = 0;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1194
                        *sllp = ll;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1195
                        RETURN ( anObject );
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1196
                    }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1197
                    if (__signedLong64IntVal(anObject, &ll)) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1198
                        *sllp = ll;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1199
                        RETURN ( anObject );
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1200
                    }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1201
                }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1202
                break;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1203
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1204
            case __MASKSMALLINT(LONGLONGARRAY):
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1205
#ifdef __NEED_LONGLONG_ALIGN
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1206
                if ((INT)pFirst & (__LONGLONG_ALIGN-1)) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1207
                    int delta = __LONGLONG_ALIGN - ((INT)pFirst & (__LONGLONG_ALIGN-1));
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1208
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1209
                    pFirst += delta;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1210
                    nbytes -= delta;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1211
                }
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1212
#endif
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1213
                if ((unsigned)indx < (nbytes>>3)) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1214
                    __uint64__ ll;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1215
                    __uint64__ *llp;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1216
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1217
                    llp = (__uint64__ *)(pFirst + (indx<<3));
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1218
                    if (anObject == __mkSmallInteger(0)) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1219
                        ll.lo = ll.hi = 0;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1220
                        *llp = ll;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1221
                        RETURN ( anObject );
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1222
                    }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1223
                    if (__unsignedLong64IntVal(anObject, &ll)) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1224
                        *llp = ll;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1225
                        RETURN ( anObject );
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1226
                    }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1227
                }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1228
                break;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1229
        }
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1230
    }
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1231
%}.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1232
    index isInteger ifFalse:[
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1233
        "
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1234
         the index should be an integer number
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1235
        "
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1236
        ^ self indexNotInteger:index
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1237
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1238
    (index between:1 and:self size) ifFalse:[
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1239
        "
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1240
         the index is less than 1 or greater than the size of the
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1241
         receiver collection
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1242
        "
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1243
        ^ self subscriptBoundsError:index
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1244
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1245
    (self class isFloatsOrDoubles) ifTrue:[
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1246
        anObject isNumber ifTrue:[
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1247
            ^ self basicAt:index put:(anObject asFloat)
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1248
        ]
5755
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
    anObject isInteger ifFalse:[
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1251
        "
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1252
         the object to put into the receiver collection
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1253
         should be an integer number
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1254
        "
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1255
        ^ self elementNotInteger
5755
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
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1258
     the object to put into the receiver collection
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1259
     is not an instance of the expected element class,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1260
     or the value is  not within the elements valid range.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1261
    "
7215
733294e1a8cc correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 7211
diff changeset
  1262
    ^ self elementBoundsError:anObject
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1263
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1264
    "Modified: 19.4.1996 / 11:14:10 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1265
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1266
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1267
byteAt:index
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  1268
    "return the byte at index.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1269
     This is only allowed for non-pointer indexed objects
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1270
     (i.e. byteArrays, wordArrays, floatArrays etc.).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1271
     The receivers indexed instvars are treated as an uninterpreted
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1272
     collection of bytes.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1273
     Only useful with binary storage."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1274
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1275
%{  /* NOCONTEXT */
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1276
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1277
    REGISTER int indx;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1278
    int nIndex;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1279
    REGISTER OBJ slf;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1280
    REGISTER OBJ cls;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1281
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1282
    if (__isSmallInteger(index)) {
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1283
        slf = self;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1284
        if (__isNonNilObject(slf)) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1285
            unsigned char *pFirst;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1286
            int nIndex;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1287
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1288
            cls = __qClass(slf);
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1289
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1290
            pFirst = __byteArrayVal(slf);
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1291
            pFirst += __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars));
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1292
            nIndex = __byteArraySize(slf);
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1293
            indx = __intVal(index) - 1;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1294
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1295
            switch ((INT)(__ClassInstPtr(cls)->c_flags) & __MASKSMALLINT(ARRAYMASK)) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1296
                case __MASKSMALLINT(DOUBLEARRAY):
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1297
#ifdef __NEED_DOUBLE_ALIGN
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1298
                    if ((INT)pFirst & (__DOUBLE_ALIGN-1)) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1299
                        int delta = __DOUBLE_ALIGN - ((INT)pFirst & (__DOUBLE_ALIGN-1));
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1300
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1301
                        pFirst += delta;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1302
                        nIndex -= delta;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1303
                    }
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1304
#endif
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1305
                    /* fall into */
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1306
                case __MASKSMALLINT(BYTEARRAY):
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1307
                case __MASKSMALLINT(WORDARRAY):
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1308
                case __MASKSMALLINT(LONGARRAY):
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1309
                case __MASKSMALLINT(SWORDARRAY):
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1310
                case __MASKSMALLINT(SLONGARRAY):
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1311
                case __MASKSMALLINT(FLOATARRAY):
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1312
                    if ((unsigned)indx < (unsigned)nIndex) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1313
                        RETURN ( __mkSmallInteger( (INT)(pFirst[indx])) );
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1314
                    }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1315
                    break;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1316
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1317
                case __MASKSMALLINT(LONGLONGARRAY):
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1318
                case __MASKSMALLINT(SLONGLONGARRAY):
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1319
#ifdef __NEED_LONGLONG_ALIGN
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1320
                    if ((INT)pFirst & (__LONGLONG_ALIGN-1)) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1321
                        int delta = __LONGLONG_ALIGN - ((INT)pFirst & (__LONGLONG_ALIGN-1));
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1322
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1323
                        pFirst += delta;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1324
                        nIndex -= delta;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1325
                    }
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1326
#endif
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1327
                    if ((unsigned)indx < (unsigned)nIndex) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1328
                        RETURN ( __mkSmallInteger( (INT)(pFirst[indx])) );
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1329
                    }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1330
                    break;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1331
            }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1332
        }
5755
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
%}.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1335
    "/ index not integer or index out of range
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1336
    "/ or non-byte indexable receiver
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1337
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1338
    ^ self primitiveFailed
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1339
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1340
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1341
     Point new byteAt:1
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1342
     (ByteArray with:1 with:2) byteAt:2
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  1343
     (WordArray with:1) byteAt:1
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  1344
     (FloatArray with:1.0) byteAt:2
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  1345
     'hello' byteAt:1
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1346
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1347
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1348
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1349
byteAt:index put:byteValue
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  1350
    "set the byte at index.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1351
     This is only allowed for non-pointer indexed objects
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1352
     (i.e. byteArrays, wordArrays, floatArrays etc.).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1353
     The receivers indexed instvars are treated as an uninterpreted
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1354
     collection of bytes.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1355
     Only useful with binary storage."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1356
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1357
%{  /* NOCONTEXT */
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1358
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1359
    REGISTER int indx;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1360
    int val, nIndex;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1361
    REGISTER OBJ slf;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1362
    REGISTER OBJ cls;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1363
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1364
    if (__bothSmallInteger(index, byteValue)) {
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1365
        val = __intVal(byteValue);
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1366
        if ((unsigned)(val) <= 0xFF /* i.e. (val >= 0) && (val <= 255) */) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1367
            slf = self;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1368
            if (__isNonNilObject(slf)) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1369
                cls = __qClass(slf);
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1370
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1371
                indx = __intVal(index) - 1;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1372
                switch ((INT)(__ClassInstPtr(cls)->c_flags) & __MASKSMALLINT(ARRAYMASK)) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1373
                    case __MASKSMALLINT(BYTEARRAY):
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1374
                    case __MASKSMALLINT(WORDARRAY):
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1375
                    case __MASKSMALLINT(LONGARRAY):
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1376
                    case __MASKSMALLINT(SWORDARRAY):
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1377
                    case __MASKSMALLINT(SLONGARRAY):
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1378
                    case __MASKSMALLINT(LONGLONGARRAY):
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1379
                    case __MASKSMALLINT(SLONGLONGARRAY):
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1380
                    case __MASKSMALLINT(FLOATARRAY):
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1381
                    case __MASKSMALLINT(DOUBLEARRAY):
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1382
                        indx += __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars));
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1383
                        nIndex = __byteArraySize(slf);
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1384
                        if ((unsigned)indx < (unsigned)nIndex) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1385
                            __ByteArrayInstPtr(slf)->ba_element[indx] = val;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1386
                            RETURN ( byteValue );
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1387
                        }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1388
                        break;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1389
                }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1390
            }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1391
        }
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1392
    }
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1393
%}.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1394
    "/ index not integer or index out of range
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1395
    "/ or non-byte indexable receiver
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1396
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1397
    ^ self primitiveFailed
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1398
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1399
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1400
     (ByteArray with:1 with:2) byteAt:2 put:3; yourself
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  1401
     'hello' copy byteAt:1 put:105; yourself
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1402
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1403
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1404
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1405
instVarAt:index
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1406
    "return a non-indexed instance variable;
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  1407
     peeking into an object this way is not very object oriented
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1408
     - use with care (needed for copy, inspector etc.)"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1409
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1410
%{  /* NOCONTEXT */
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
    OBJ myClass;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1413
    int idx, ninstvars;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1414
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1415
    if (__isSmallInteger(index)) {
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1416
        myClass = __Class(self);
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1417
        idx = __intVal(index) - 1;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1418
        /*
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1419
         * do not allow returning of non-object fields.
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1420
         * if subclass did not make provisions for that,
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1421
         * we won't do so here ...
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1422
         */
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1423
        if (((INT)(__ClassInstPtr(myClass)->c_flags) & __MASKSMALLINT(NONOBJECT_INSTS))) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1424
            if (idx == 0) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1425
                RETURN ( nil )
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1426
            }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1427
        }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1428
        ninstvars = __intVal(__ClassInstPtr(myClass)->c_ninstvars);
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1429
        if ((idx >= 0) && (idx < ninstvars)) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1430
            RETURN ( __InstPtr(self)->i_instvars[idx] );
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1431
        }
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1432
    }
7216
59bfa2ffdcf7 utility
Claus Gittinger <cg@exept.de>
parents: 7215
diff changeset
  1433
%}.
59bfa2ffdcf7 utility
Claus Gittinger <cg@exept.de>
parents: 7215
diff changeset
  1434
    ^ self indexNotIntegerOrOutOfBounds:index
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1435
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1436
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1437
instVarAt:index put:value
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1438
    "change a non-indexed instance variable;
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  1439
     peeking into an object this way is not very object oriented
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1440
     - use with care (needed for copy, inspector etc.)"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1441
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1442
%{  /* NOCONTEXT */
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1443
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1444
    OBJ myClass;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1445
    int idx, ninstvars;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1446
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1447
    if (__isSmallInteger(index)) {
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1448
        myClass = __Class(self);
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1449
        idx = __intVal(index) - 1;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1450
        ninstvars = __intVal(__ClassInstPtr(myClass)->c_ninstvars);
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1451
        /*
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1452
         * do not allow setting of non-object fields.
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1453
         * if subclass did not make provisions for that,
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1454
         * we won't do so here ...
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1455
         */
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1456
        if (((INT)(__ClassInstPtr(myClass)->c_flags) & __MASKSMALLINT(NONOBJECT_INSTS))) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1457
            if (idx == 0) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1458
                RETURN ( nil )
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1459
            }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1460
        }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1461
        if ((idx >= 0) && (idx < ninstvars)) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1462
            __InstPtr(self)->i_instvars[idx] = value;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1463
            __STORE(self, value);
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1464
            RETURN ( value );
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1465
        }
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1466
    }
7216
59bfa2ffdcf7 utility
Claus Gittinger <cg@exept.de>
parents: 7215
diff changeset
  1467
%}.
59bfa2ffdcf7 utility
Claus Gittinger <cg@exept.de>
parents: 7215
diff changeset
  1468
    ^ self indexNotIntegerOrOutOfBounds:index
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1469
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1470
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  1471
instVarNamed:name
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1472
    "return a non-indexed instance variables value by name;
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  1473
     peeking into an object this way is not very object oriented
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1474
     - 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
  1475
     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
  1476
     parsed ad runtime)"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1477
10918
a4635305501e #instVarNamed* - raise KeyNotFoundError if an instaver does not exist
Stefan Vogel <sv@exept.de>
parents: 10877
diff changeset
  1478
    |idx|
a4635305501e #instVarNamed* - raise KeyNotFoundError if an instaver does not exist
Stefan Vogel <sv@exept.de>
parents: 10877
diff changeset
  1479
a4635305501e #instVarNamed* - raise KeyNotFoundError if an instaver does not exist
Stefan Vogel <sv@exept.de>
parents: 10877
diff changeset
  1480
    idx := self class instVarOffsetOf:name.
a4635305501e #instVarNamed* - raise KeyNotFoundError if an instaver does not exist
Stefan Vogel <sv@exept.de>
parents: 10877
diff changeset
  1481
    idx isNil ifTrue:[
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1482
        ^ self errorKeyNotFound:name.
11335
c061d08b766f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11314
diff changeset
  1483
    ].
10918
a4635305501e #instVarNamed* - raise KeyNotFoundError if an instaver does not exist
Stefan Vogel <sv@exept.de>
parents: 10877
diff changeset
  1484
    ^ self instVarAt:idx.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1485
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1486
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1487
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1488
     |p|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1489
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1490
     p := Point x:10 y:20.
10918
a4635305501e #instVarNamed* - raise KeyNotFoundError if an instaver does not exist
Stefan Vogel <sv@exept.de>
parents: 10877
diff changeset
  1491
     p instVarNamed:'cx'
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1492
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1493
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1494
    "Modified: 19.4.1996 / 11:12:39 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1495
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1496
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1497
instVarNamed:name ifAbsent:exceptionBlock
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1498
    "return a non-indexed instance variables value by name,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1499
     or the value of exceptionBlock, if there is no such instance variable.
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  1500
     peeking into an object this way is not very object oriented
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1501
     - 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
  1502
     Notice, this access is very slow (because the classes instVar-description has to be
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1503
     parsed ad runtime)"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1504
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1505
    |idx|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1506
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1507
    idx := self class instVarOffsetOf:name.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1508
    idx isNil ifTrue:[^ exceptionBlock value].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1509
    ^ self instVarAt:idx
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
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1513
     |p|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1514
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1515
     p := Point x:10 y:20.
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  1516
     p instVarNamed:'x'
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1517
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1518
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1519
    "Created: 6.7.1996 / 23:02:49 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1520
    "Modified: 6.7.1996 / 23:03:41 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1521
!
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
instVarNamed:name put:value
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1524
    "set a non-indexed instance variable by name;
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  1525
     peeking into an object this way is not very object oriented
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1526
     - if at all, use with care (provided for protocol completeness).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1527
     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
  1528
     parsed ad runtime)"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1529
10918
a4635305501e #instVarNamed* - raise KeyNotFoundError if an instaver does not exist
Stefan Vogel <sv@exept.de>
parents: 10877
diff changeset
  1530
    |idx|
a4635305501e #instVarNamed* - raise KeyNotFoundError if an instaver does not exist
Stefan Vogel <sv@exept.de>
parents: 10877
diff changeset
  1531
a4635305501e #instVarNamed* - raise KeyNotFoundError if an instaver does not exist
Stefan Vogel <sv@exept.de>
parents: 10877
diff changeset
  1532
    idx := self class instVarOffsetOf:name.
a4635305501e #instVarNamed* - raise KeyNotFoundError if an instaver does not exist
Stefan Vogel <sv@exept.de>
parents: 10877
diff changeset
  1533
    idx isNil ifTrue:[
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1534
        ^ self errorKeyNotFound:name.
11335
c061d08b766f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11314
diff changeset
  1535
    ].
10918
a4635305501e #instVarNamed* - raise KeyNotFoundError if an instaver does not exist
Stefan Vogel <sv@exept.de>
parents: 10877
diff changeset
  1536
    ^ self instVarAt:idx put:value.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1537
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1538
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1539
     |p|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1540
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1541
     p := Point x:10 y:20.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1542
     p instVarNamed:'x' put:30.
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  1543
     p
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1544
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1545
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1546
    "Modified: 19.4.1996 / 11:12:49 / cg"
10918
a4635305501e #instVarNamed* - raise KeyNotFoundError if an instaver does not exist
Stefan Vogel <sv@exept.de>
parents: 10877
diff changeset
  1547
!
a4635305501e #instVarNamed* - raise KeyNotFoundError if an instaver does not exist
Stefan Vogel <sv@exept.de>
parents: 10877
diff changeset
  1548
a4635305501e #instVarNamed* - raise KeyNotFoundError if an instaver does not exist
Stefan Vogel <sv@exept.de>
parents: 10877
diff changeset
  1549
instVarNamed:name put:anObject ifAbsent:exceptionBlock
a4635305501e #instVarNamed* - raise KeyNotFoundError if an instaver does not exist
Stefan Vogel <sv@exept.de>
parents: 10877
diff changeset
  1550
    "return a non-indexed instance variables value by name,
a4635305501e #instVarNamed* - raise KeyNotFoundError if an instaver does not exist
Stefan Vogel <sv@exept.de>
parents: 10877
diff changeset
  1551
     or the value of exceptionBlock, if there is no such instance variable.
a4635305501e #instVarNamed* - raise KeyNotFoundError if an instaver does not exist
Stefan Vogel <sv@exept.de>
parents: 10877
diff changeset
  1552
     peeking into an object this way is not very object oriented
a4635305501e #instVarNamed* - raise KeyNotFoundError if an instaver does not exist
Stefan Vogel <sv@exept.de>
parents: 10877
diff changeset
  1553
     - use with care if at all (provided for inspectors and memory usage monitor).
a4635305501e #instVarNamed* - raise KeyNotFoundError if an instaver does not exist
Stefan Vogel <sv@exept.de>
parents: 10877
diff changeset
  1554
     Notice, this access is very slow (because the classes instVar-description has to be
a4635305501e #instVarNamed* - raise KeyNotFoundError if an instaver does not exist
Stefan Vogel <sv@exept.de>
parents: 10877
diff changeset
  1555
     parsed ad runtime)"
a4635305501e #instVarNamed* - raise KeyNotFoundError if an instaver does not exist
Stefan Vogel <sv@exept.de>
parents: 10877
diff changeset
  1556
a4635305501e #instVarNamed* - raise KeyNotFoundError if an instaver does not exist
Stefan Vogel <sv@exept.de>
parents: 10877
diff changeset
  1557
    |idx|
a4635305501e #instVarNamed* - raise KeyNotFoundError if an instaver does not exist
Stefan Vogel <sv@exept.de>
parents: 10877
diff changeset
  1558
a4635305501e #instVarNamed* - raise KeyNotFoundError if an instaver does not exist
Stefan Vogel <sv@exept.de>
parents: 10877
diff changeset
  1559
    idx := self class instVarOffsetOf:name.
a4635305501e #instVarNamed* - raise KeyNotFoundError if an instaver does not exist
Stefan Vogel <sv@exept.de>
parents: 10877
diff changeset
  1560
    idx isNil ifTrue:[^ exceptionBlock value].
a4635305501e #instVarNamed* - raise KeyNotFoundError if an instaver does not exist
Stefan Vogel <sv@exept.de>
parents: 10877
diff changeset
  1561
    ^ self instVarAt:idx put:anObject.
a4635305501e #instVarNamed* - raise KeyNotFoundError if an instaver does not exist
Stefan Vogel <sv@exept.de>
parents: 10877
diff changeset
  1562
a4635305501e #instVarNamed* - raise KeyNotFoundError if an instaver does not exist
Stefan Vogel <sv@exept.de>
parents: 10877
diff changeset
  1563
a4635305501e #instVarNamed* - raise KeyNotFoundError if an instaver does not exist
Stefan Vogel <sv@exept.de>
parents: 10877
diff changeset
  1564
    "
a4635305501e #instVarNamed* - raise KeyNotFoundError if an instaver does not exist
Stefan Vogel <sv@exept.de>
parents: 10877
diff changeset
  1565
     |p|
a4635305501e #instVarNamed* - raise KeyNotFoundError if an instaver does not exist
Stefan Vogel <sv@exept.de>
parents: 10877
diff changeset
  1566
a4635305501e #instVarNamed* - raise KeyNotFoundError if an instaver does not exist
Stefan Vogel <sv@exept.de>
parents: 10877
diff changeset
  1567
     p := Point x:10 y:20.
a4635305501e #instVarNamed* - raise KeyNotFoundError if an instaver does not exist
Stefan Vogel <sv@exept.de>
parents: 10877
diff changeset
  1568
     p instVarNamed:'x' put:4711 ifAbsent:[self halt:'no such instvar'].
a4635305501e #instVarNamed* - raise KeyNotFoundError if an instaver does not exist
Stefan Vogel <sv@exept.de>
parents: 10877
diff changeset
  1569
     p instVarNamed:'bla' put:4712 ifAbsent:[self halt:'no such instvar'].
a4635305501e #instVarNamed* - raise KeyNotFoundError if an instaver does not exist
Stefan Vogel <sv@exept.de>
parents: 10877
diff changeset
  1570
     p inspect.
a4635305501e #instVarNamed* - raise KeyNotFoundError if an instaver does not exist
Stefan Vogel <sv@exept.de>
parents: 10877
diff changeset
  1571
    "
a4635305501e #instVarNamed* - raise KeyNotFoundError if an instaver does not exist
Stefan Vogel <sv@exept.de>
parents: 10877
diff changeset
  1572
a4635305501e #instVarNamed* - raise KeyNotFoundError if an instaver does not exist
Stefan Vogel <sv@exept.de>
parents: 10877
diff changeset
  1573
    "Created: 6.7.1996 / 23:02:49 / cg"
a4635305501e #instVarNamed* - raise KeyNotFoundError if an instaver does not exist
Stefan Vogel <sv@exept.de>
parents: 10877
diff changeset
  1574
    "Modified: 6.7.1996 / 23:03:41 / cg"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1575
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1576
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1577
!Object methodsFor:'attributes access'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1578
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  1579
objectAttributeAt:attributeKey
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1580
    "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
  1581
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1582
    | attrs |
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
    attrs := self objectAttributes.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1585
    (attrs notNil and:[attrs size > 0]) ifTrue:[
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1586
        ^ attrs at:attributeKey ifAbsent:[]
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1587
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1588
    ^ nil
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1589
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1590
    "Created: / 22.1.1998 / 21:29:17 / av"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1591
    "Modified: / 3.2.1998 / 18:55:55 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1592
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1593
6323
9dbabd4270d3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6321
diff changeset
  1594
objectAttributeAt:attributeKey put:anObject
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1595
    "store the attribute anObject referenced by key into the receiver"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1596
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1597
    "/ must do this save from interrupts, since the attributes collection
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1598
    "/ is possibly accessed from multiple threads ...
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1599
    [
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1600
        | attrs |
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1601
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1602
        attrs := self objectAttributes.
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1603
        (attrs isNil or:[attrs size == 0]) ifTrue:[
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1604
            attrs := WeakIdentityDictionary new.
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1605
            attrs at:attributeKey put:anObject.
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1606
            self objectAttributes:attrs.
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1607
        ] ifFalse:[
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1608
            attrs at:attributeKey put:anObject.
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1609
        ].
6323
9dbabd4270d3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6321
diff changeset
  1610
    ] valueUninterruptably
5755
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
    "Attaching additional attributes (slots) to an arbitrary object:
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1613
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1614
     |p|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1615
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1616
     p := Point new.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1617
     p objectAttributeAt:#color put:#green.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1618
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1619
     p objectAttributeAt:#color
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1620
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1621
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1622
    "Created: / 22.1.1998 / 21:29:25 / av"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1623
    "Modified: / 3.2.1998 / 18:57:58 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1624
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1625
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1626
objectAttributes
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1627
    "return a Collection of attributes - nil if there is none.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1628
     The default implementation here uses a global WeakDictionary to store
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1629
     attributes
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1630
     This may be too slow for high frequency slot access,
13416
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  1631
     therefore, some classes may redefine this for better performnce.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1632
     Notice the mentioning of a WeakDictionary - read the classes documentation."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1633
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1634
    ^ ObjectAttributes at:self ifAbsent:[nil]
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1635
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1636
    "Created: / 22.1.1998 / 21:29:30 / av"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1637
    "Modified: / 18.2.2000 / 11:34:16 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1638
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1639
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1640
objectAttributes:aCollection
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1641
    "set the collection of attributes.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1642
     The default implementation here uses a global Dictionary to store
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1643
     attributes which may be too slow for high frequency change&update.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1644
     Therefore, some classes may redefine this for better performance."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1645
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1646
    "/ must do this save from interrupts, since the attributes collection
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1647
    "/ is possibly accessed from multiple threads.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1648
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1649
    (OperatingSystem blockInterrupts) ifTrue:[
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1650
        "/ the common case - already blocked
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1651
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1652
        (aCollection isNil or:[aCollection isEmpty]) ifTrue:[
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1653
            ObjectAttributes removeKey:self ifAbsent:nil
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1654
        ] ifFalse:[
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1655
            ObjectAttributes at:self put:aCollection
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1656
        ].
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1657
        ^ self
5755
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
    [
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1661
        (aCollection isNil or:[aCollection isEmpty]) ifTrue:[
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1662
            ObjectAttributes removeKey:self ifAbsent:nil
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1663
        ] ifFalse:[
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1664
            ObjectAttributes at:self put:aCollection
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1665
        ].
6421
58dca33cf0fc #valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents: 6418
diff changeset
  1666
    ] ensure:[
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1667
        OperatingSystem unblockInterrupts
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1668
    ]
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1669
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1670
    "Created: / 22.1.1998 / 21:29:35 / av"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1671
    "Modified: / 3.2.1998 / 18:58:10 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1672
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1673
6323
9dbabd4270d3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6321
diff changeset
  1674
removeObjectAttribute:attributeKey
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1675
    "make the argument, anObject be no attribute of the receiver"
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
    "/ must do this save from interrupts, since the attributes collection
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1678
    "/ is possibly accessed from multiple threads.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1679
    [
13488
c32441603ca6 changed: #removeObjectAttribute:
Claus Gittinger <cg@exept.de>
parents: 13487
diff changeset
  1680
        |attrs n a|
c32441603ca6 changed: #removeObjectAttribute:
Claus Gittinger <cg@exept.de>
parents: 13487
diff changeset
  1681
c32441603ca6 changed: #removeObjectAttribute:
Claus Gittinger <cg@exept.de>
parents: 13487
diff changeset
  1682
        attrs := self objectAttributes.
c32441603ca6 changed: #removeObjectAttribute:
Claus Gittinger <cg@exept.de>
parents: 13487
diff changeset
  1683
        attrs notNil ifTrue:[
c32441603ca6 changed: #removeObjectAttribute:
Claus Gittinger <cg@exept.de>
parents: 13487
diff changeset
  1684
            attrs size == 0 ifTrue:[
c32441603ca6 changed: #removeObjectAttribute:
Claus Gittinger <cg@exept.de>
parents: 13487
diff changeset
  1685
                self objectAttributes:nil
c32441603ca6 changed: #removeObjectAttribute:
Claus Gittinger <cg@exept.de>
parents: 13487
diff changeset
  1686
            ] ifFalse:[
c32441603ca6 changed: #removeObjectAttribute:
Claus Gittinger <cg@exept.de>
parents: 13487
diff changeset
  1687
                attrs removeKey:attributeKey ifAbsent:nil.
c32441603ca6 changed: #removeObjectAttribute:
Claus Gittinger <cg@exept.de>
parents: 13487
diff changeset
  1688
                attrs size == 0 ifTrue:[
c32441603ca6 changed: #removeObjectAttribute:
Claus Gittinger <cg@exept.de>
parents: 13487
diff changeset
  1689
                    self objectAttributes:nil
c32441603ca6 changed: #removeObjectAttribute:
Claus Gittinger <cg@exept.de>
parents: 13487
diff changeset
  1690
                ]
c32441603ca6 changed: #removeObjectAttribute:
Claus Gittinger <cg@exept.de>
parents: 13487
diff changeset
  1691
            ]
c32441603ca6 changed: #removeObjectAttribute:
Claus Gittinger <cg@exept.de>
parents: 13487
diff changeset
  1692
        ]
6323
9dbabd4270d3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6321
diff changeset
  1693
    ] valueUninterruptably
5755
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
    "Created: / 22.1.1998 / 21:29:39 / av"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1696
    "Modified: / 18.2.2000 / 11:32:19 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1697
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1698
13500
51b2e6c6c2ac changed:
Claus Gittinger <cg@exept.de>
parents: 13488
diff changeset
  1699
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1700
!Object methodsFor:'change & update'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1701
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1702
broadcast:aSelectorSymbol
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1703
    "send a message with selector aSelectorSymbol to all my dependents"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1704
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  1705
    self dependentsDo:[:dependent |
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1706
        dependent perform:aSelectorSymbol
5755
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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1710
broadcast:aSelectorSymbol with:anArgument
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1711
    "send a message with selector aSelectorSymbol with an additional
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1712
     argument anArgument to all my dependents."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1713
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  1714
    self dependentsDo:[:dependent |
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1715
        dependent perform:aSelectorSymbol with:anArgument
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1716
    ]
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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1719
changeRequest
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1720
    "the receiver wants to change - check if all dependents
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1721
     grant the request, and return true if so"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1722
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  1723
    self dependentsDo:[:dependent |
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1724
        dependent updateRequest ifFalse:[^ false].
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1725
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1726
    ^ true
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
11551
170f7fae1bfc updateRequest
Claus Gittinger <cg@exept.de>
parents: 11541
diff changeset
  1729
changeRequest:aSymbol
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1730
    "the receiver wants to change - check if all dependents
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1731
     grant the request, and return true if so"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1732
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  1733
    self dependentsDo:[:dependent |
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1734
        (dependent updateRequest:aSymbol) ifFalse:[^ false].
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1735
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1736
    ^ true
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
11551
170f7fae1bfc updateRequest
Claus Gittinger <cg@exept.de>
parents: 11541
diff changeset
  1739
changeRequest:aSymbol from:anObject
170f7fae1bfc updateRequest
Claus Gittinger <cg@exept.de>
parents: 11541
diff changeset
  1740
    "the receiver wants to change - check if all dependents
170f7fae1bfc updateRequest
Claus Gittinger <cg@exept.de>
parents: 11541
diff changeset
  1741
     except anObject grant the request, and return true if so.
170f7fae1bfc updateRequest
Claus Gittinger <cg@exept.de>
parents: 11541
diff changeset
  1742
     The argument anObject is typically going to be the one who is
170f7fae1bfc updateRequest
Claus Gittinger <cg@exept.de>
parents: 11541
diff changeset
  1743
     about to send the change request."
170f7fae1bfc updateRequest
Claus Gittinger <cg@exept.de>
parents: 11541
diff changeset
  1744
170f7fae1bfc updateRequest
Claus Gittinger <cg@exept.de>
parents: 11541
diff changeset
  1745
    ^ self changeRequest:aSymbol with:nil from:anObject
170f7fae1bfc updateRequest
Claus Gittinger <cg@exept.de>
parents: 11541
diff changeset
  1746
!
170f7fae1bfc updateRequest
Claus Gittinger <cg@exept.de>
parents: 11541
diff changeset
  1747
170f7fae1bfc updateRequest
Claus Gittinger <cg@exept.de>
parents: 11541
diff changeset
  1748
changeRequest:aSymbol with:aParameter
170f7fae1bfc updateRequest
Claus Gittinger <cg@exept.de>
parents: 11541
diff changeset
  1749
    "the receiver wants to change - check if all dependents
170f7fae1bfc updateRequest
Claus Gittinger <cg@exept.de>
parents: 11541
diff changeset
  1750
     grant the request, and return true if so"
170f7fae1bfc updateRequest
Claus Gittinger <cg@exept.de>
parents: 11541
diff changeset
  1751
11573
cc09bff8a992 *** empty log message ***
ca
parents: 11551
diff changeset
  1752
    ^ self changeRequest:aSymbol with:aParameter from:self
11551
170f7fae1bfc updateRequest
Claus Gittinger <cg@exept.de>
parents: 11541
diff changeset
  1753
!
170f7fae1bfc updateRequest
Claus Gittinger <cg@exept.de>
parents: 11541
diff changeset
  1754
170f7fae1bfc updateRequest
Claus Gittinger <cg@exept.de>
parents: 11541
diff changeset
  1755
changeRequest:aSymbol with:aParameter from:anObject
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1756
    "the receiver wants to change - check if all dependents
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1757
     except anObject grant the request, and return true if so.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1758
     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
  1759
     about to send the change request."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1760
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  1761
    self dependentsDo:[:dependent |
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1762
        dependent == anObject ifFalse:[
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1763
            (dependent updateRequest:aSymbol with:aParameter from:anObject) ifFalse:[^ false].
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1764
        ]
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1765
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1766
    ^ true
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1767
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1768
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1769
changeRequestFrom:anObject
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1770
    "the receiver wants to change - check if all dependents
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1771
     except anObject grant the request, and return true if so.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1772
     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
  1773
     about to send the change request."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1774
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  1775
    self dependentsDo:[:dependent |
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1776
        dependent == anObject ifFalse:[
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1777
            (dependent updateRequest) ifFalse:[^ false].
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1778
        ]
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1779
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1780
    ^ true
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1781
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1782
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1783
changed
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1784
    "notify all dependents that the receiver has changed.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1785
     Each dependent gets a '#update:'-message with the original
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1786
     receiver as argument."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1787
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1788
    self changed:nil
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1789
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1790
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1791
changed:aParameter
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1792
    "notify all dependents that the receiver has changed somehow.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1793
     Each dependent gets a '#update:'-message with aParameter
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1794
     as argument."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1795
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1796
    self changed:aParameter with:nil
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1797
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1798
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1799
changed:aParameter with:anArgument
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1800
    "notify all dependents that the receiver has changed somehow.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1801
     Each dependent gets a  '#update:with:from:'-message, with aParameter
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1802
     and anArgument as arguments."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1803
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  1804
    self dependentsDo:[:dependent |
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1805
        dependent update:aParameter with:anArgument from:self
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1806
    ]
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1807
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1808
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1809
update:aParameter
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1810
    "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
  1811
     on whom the receiver depends, has changed. The argument aParameter
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1812
     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
  1813
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1814
     Default behavior here is to do nothing"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1815
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1816
    ^ self
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1817
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1818
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1819
update:aParameter with:anArgument
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1820
    "dependent is notified of some change -
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1821
     Default is to try update:"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1822
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1823
    ^ self update:aParameter
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1824
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1825
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1826
update:aParameter with:anArgument from:sender
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1827
    "dependent is notified of some change -
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1828
     Default is to try update:with:"
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
    ^ self update:aParameter with:anArgument
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1831
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1832
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1833
updateRequest
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1834
    "return true, if an update request is granted.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1835
     Default here is to grant updates - may be used
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1836
     to lock updates if someone is making other changes
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1837
     from within an update. Or if someone has locked its
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1838
     state and does not want others to change things.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1839
     However, these dependents must all honor the
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1840
     changeRequest - ifTrue - change protocol. I.e. they
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1841
     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
  1842
     it returns true. The others must decide in updateRequest and
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1843
     return true if they think a change is ok."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1844
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1845
    ^ true
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1846
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1847
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1848
updateRequest:aSymbol
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1849
    "return true, if an update request is granted.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1850
     Default here a simple updateRequest"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1851
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1852
    ^ self updateRequest
7177
2bfa42d795a0 added withoutUpdating:do:
martin
parents: 7159
diff changeset
  1853
!
2bfa42d795a0 added withoutUpdating:do:
martin
parents: 7159
diff changeset
  1854
11551
170f7fae1bfc updateRequest
Claus Gittinger <cg@exept.de>
parents: 11541
diff changeset
  1855
updateRequest:aSymbol with:aParameter
170f7fae1bfc updateRequest
Claus Gittinger <cg@exept.de>
parents: 11541
diff changeset
  1856
    "return true, if an update request is granted.
170f7fae1bfc updateRequest
Claus Gittinger <cg@exept.de>
parents: 11541
diff changeset
  1857
     Default here a simple updateRequest"
170f7fae1bfc updateRequest
Claus Gittinger <cg@exept.de>
parents: 11541
diff changeset
  1858
170f7fae1bfc updateRequest
Claus Gittinger <cg@exept.de>
parents: 11541
diff changeset
  1859
    ^ self updateRequest:aSymbol
170f7fae1bfc updateRequest
Claus Gittinger <cg@exept.de>
parents: 11541
diff changeset
  1860
!
170f7fae1bfc updateRequest
Claus Gittinger <cg@exept.de>
parents: 11541
diff changeset
  1861
170f7fae1bfc updateRequest
Claus Gittinger <cg@exept.de>
parents: 11541
diff changeset
  1862
updateRequest:aSymbol with:aParameter from:sender
170f7fae1bfc updateRequest
Claus Gittinger <cg@exept.de>
parents: 11541
diff changeset
  1863
    "return true, if an update request is granted.
170f7fae1bfc updateRequest
Claus Gittinger <cg@exept.de>
parents: 11541
diff changeset
  1864
     Default here a simple updateRequest"
170f7fae1bfc updateRequest
Claus Gittinger <cg@exept.de>
parents: 11541
diff changeset
  1865
170f7fae1bfc updateRequest
Claus Gittinger <cg@exept.de>
parents: 11541
diff changeset
  1866
    ^ self updateRequest:aSymbol with:aParameter
170f7fae1bfc updateRequest
Claus Gittinger <cg@exept.de>
parents: 11541
diff changeset
  1867
!
170f7fae1bfc updateRequest
Claus Gittinger <cg@exept.de>
parents: 11541
diff changeset
  1868
7177
2bfa42d795a0 added withoutUpdating:do:
martin
parents: 7159
diff changeset
  1869
withoutUpdating:someone do:aBlock
2bfa42d795a0 added withoutUpdating:do:
martin
parents: 7159
diff changeset
  1870
    "evaluate a block but remove someone from my dependents temporarily"
2bfa42d795a0 added withoutUpdating:do:
martin
parents: 7159
diff changeset
  1871
2bfa42d795a0 added withoutUpdating:do:
martin
parents: 7159
diff changeset
  1872
    (self dependents includesIdentical:someone)
2bfa42d795a0 added withoutUpdating:do:
martin
parents: 7159
diff changeset
  1873
    ifFalse:[
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1874
        ^ aBlock value.
7177
2bfa42d795a0 added withoutUpdating:do:
martin
parents: 7159
diff changeset
  1875
    ].
2bfa42d795a0 added withoutUpdating:do:
martin
parents: 7159
diff changeset
  1876
    self removeDependent:someone.
2bfa42d795a0 added withoutUpdating:do:
martin
parents: 7159
diff changeset
  1877
    ^ aBlock ensure:[ self addDependent:someone ]
5755
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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1880
!Object methodsFor:'cleanup'!
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
lowSpaceCleanup
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1883
    "ignored here - redefined in some classes to
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1884
     cleanup in low-memory situations"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1885
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1886
    ^ self
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1887
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1888
14296
fe82bc5091f9 added: #isUUID
Stefan Vogel <sv@exept.de>
parents: 14292
diff changeset
  1889
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1890
!Object methodsFor:'comparing'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1891
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1892
= anObject
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1893
    "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
  1894
     Notice:
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1895
        This method is partially open coded (inlined) by the compiler(s)
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1896
        identical objects are always considered equal.
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1897
        redefining it may not work as expected."
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
    ^ self == anObject
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1900
!
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
== anObject
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1903
    "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
  1904
     Never redefine this in any class.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1905
     Notice:
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1906
        This method is open coded (inlined) by the compiler(s)
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1907
        - redefining it may not work as expected."
5755
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
%{  /* NOCONTEXT */
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
    RETURN ( (self == anObject) ? true : false );
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1912
%}
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1913
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1914
5814
f4f6da3e7631 Define #deepSameContentsAs:
Stefan Vogel <sv@exept.de>
parents: 5806
diff changeset
  1915
deepSameContentsAs:anObject
f4f6da3e7631 Define #deepSameContentsAs:
Stefan Vogel <sv@exept.de>
parents: 5806
diff changeset
  1916
    "return true, if the receiver and the arg have the same contents
f4f6da3e7631 Define #deepSameContentsAs:
Stefan Vogel <sv@exept.de>
parents: 5806
diff changeset
  1917
     in both the named instance vars and any indexed instVars.
f4f6da3e7631 Define #deepSameContentsAs:
Stefan Vogel <sv@exept.de>
parents: 5806
diff changeset
  1918
     This method descends into referenced objects, where #sameContentsAs: does not descend"
f4f6da3e7631 Define #deepSameContentsAs:
Stefan Vogel <sv@exept.de>
parents: 5806
diff changeset
  1919
5821
c11bb6c8cc8f Cleanup unused method vars
Stefan Vogel <sv@exept.de>
parents: 5814
diff changeset
  1920
    |myClass val
5814
f4f6da3e7631 Define #deepSameContentsAs:
Stefan Vogel <sv@exept.de>
parents: 5806
diff changeset
  1921
     sz "{ Class: SmallInteger }" |
f4f6da3e7631 Define #deepSameContentsAs:
Stefan Vogel <sv@exept.de>
parents: 5806
diff changeset
  1922
f4f6da3e7631 Define #deepSameContentsAs:
Stefan Vogel <sv@exept.de>
parents: 5806
diff changeset
  1923
    myClass := self class.
f4f6da3e7631 Define #deepSameContentsAs:
Stefan Vogel <sv@exept.de>
parents: 5806
diff changeset
  1924
    myClass isVariable ifTrue:[
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1925
        sz := self basicSize.
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1926
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1927
        "compare the indexed variables"
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1928
        1 to:sz do:[:i |
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1929
            val := self basicAt:i.
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1930
            val isLiteral ifTrue:[
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1931
                val = (anObject basicAt:i) ifFalse:[^ false].
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1932
            ] ifFalse:[
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1933
                (val deepSameContentsAs:(anObject basicAt:i)) ifFalse:[^ false].
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1934
            ]
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1935
        ]
5814
f4f6da3e7631 Define #deepSameContentsAs:
Stefan Vogel <sv@exept.de>
parents: 5806
diff changeset
  1936
    ].
f4f6da3e7631 Define #deepSameContentsAs:
Stefan Vogel <sv@exept.de>
parents: 5806
diff changeset
  1937
f4f6da3e7631 Define #deepSameContentsAs:
Stefan Vogel <sv@exept.de>
parents: 5806
diff changeset
  1938
    "compare the instance variables"
f4f6da3e7631 Define #deepSameContentsAs:
Stefan Vogel <sv@exept.de>
parents: 5806
diff changeset
  1939
    sz := myClass instSize.
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  1940
    1 to:sz do:[:i |
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1941
        val := self instVarAt:i.
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1942
        val isLiteral ifTrue:[
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1943
            val = (anObject instVarAt:i) ifFalse:[^ false].
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1944
        ] ifFalse:[
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1945
            (val deepSameContentsAs:(anObject instVarAt:i)) ifFalse:[^ false].
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1946
        ]
5814
f4f6da3e7631 Define #deepSameContentsAs:
Stefan Vogel <sv@exept.de>
parents: 5806
diff changeset
  1947
    ].
f4f6da3e7631 Define #deepSameContentsAs:
Stefan Vogel <sv@exept.de>
parents: 5806
diff changeset
  1948
f4f6da3e7631 Define #deepSameContentsAs:
Stefan Vogel <sv@exept.de>
parents: 5806
diff changeset
  1949
    ^ true
f4f6da3e7631 Define #deepSameContentsAs:
Stefan Vogel <sv@exept.de>
parents: 5806
diff changeset
  1950
f4f6da3e7631 Define #deepSameContentsAs:
Stefan Vogel <sv@exept.de>
parents: 5806
diff changeset
  1951
    "
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  1952
     #(1 2 3 4) deepSameContentsAs:#[1 2 3 4] asArray
5814
f4f6da3e7631 Define #deepSameContentsAs:
Stefan Vogel <sv@exept.de>
parents: 5806
diff changeset
  1953
     (1@2) deepSameContentsAs:(1->2)
f4f6da3e7631 Define #deepSameContentsAs:
Stefan Vogel <sv@exept.de>
parents: 5806
diff changeset
  1954
    "
f4f6da3e7631 Define #deepSameContentsAs:
Stefan Vogel <sv@exept.de>
parents: 5806
diff changeset
  1955
!
f4f6da3e7631 Define #deepSameContentsAs:
Stefan Vogel <sv@exept.de>
parents: 5806
diff changeset
  1956
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1957
hash
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1958
    "return an Integer useful as a hash key for the receiver.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1959
     This hash should return same values for objects with same
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1960
     contents (i.e. use this to hash on structure)"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1961
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1962
    ^ self identityHash
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1963
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1964
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1965
identityHash
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1966
    "return an Integer useful as a hash key for the receiver.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1967
     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
  1968
     this to hash on identity of objects).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1969
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1970
     We cannot use the Objects address (as other smalltalks do) since
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1971
     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
  1972
     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
  1973
     Id in the object header itself as its hashed upon.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1974
     (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
  1975
     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
  1976
     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
  1977
     hashed-upon objects could add an instvar containing the hash value."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1978
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1979
%{  /* NOCONTEXT */
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1980
5806
a7361ebe686a avoid warnings on alpha (int-size)
Claus Gittinger <cg@exept.de>
parents: 5769
diff changeset
  1981
    REGISTER unsigned INT hash;
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1982
    static unsigned nextHash = 0;
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
    if (__isNonNilObject(self)) {
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1985
        hash = __GET_HASH(self);
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1986
        if (hash == 0) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1987
            /* has no hash yet */
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1988
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1989
            if (++nextHash > __MAX_HASH__) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1990
                nextHash = 1;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1991
            }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1992
            hash = nextHash;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1993
            __SET_HASH(self, hash);
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1994
        }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1995
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1996
        /*
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1997
         * now, we got 11 bits for hashing;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1998
         * make it as large as possible; since most hashers use the returned
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  1999
         * key and take it modulo some prime number, this will allow for
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2000
         * better distribution (i.e. bigger empty spaces) in hashed collection.
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2001
         */
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2002
        hash = __MAKE_HASH__(hash);
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2003
        RETURN ( __mkSmallInteger(hash) );
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2004
    }
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2005
%}.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2006
    ^ 0 "never reached, since redefined in UndefinedObject and SmallInteger"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2007
!
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
identityHashForBinaryStore
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2010
    "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
  2011
     and does not #become something else, while the hash is used.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2012
     This is only used by the binary storage mechanism, during the
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2013
     object writing phase."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2014
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2015
%{  /* NOCONTEXT */
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2016
5806
a7361ebe686a avoid warnings on alpha (int-size)
Claus Gittinger <cg@exept.de>
parents: 5769
diff changeset
  2017
    REGISTER unsigned INT hash, hash1, hash2, sz;
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2018
    OBJ o;
5806
a7361ebe686a avoid warnings on alpha (int-size)
Claus Gittinger <cg@exept.de>
parents: 5769
diff changeset
  2019
    static unsigned INT nextHash = 0;
a7361ebe686a avoid warnings on alpha (int-size)
Claus Gittinger <cg@exept.de>
parents: 5769
diff changeset
  2020
    static unsigned INT nextClassHash = 0;
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2021
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2022
    if (__isNonNilObject(self)) {
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2023
        /*
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2024
         * my own identityHash
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2025
         */
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2026
        hash1 = __GET_HASH(self);
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2027
        if (hash1 == 0) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2028
            /* has no hash yet */
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2029
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2030
            if (++nextHash > __MAX_HASH__) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2031
                nextHash = 1;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2032
            }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2033
            hash1 = nextHash;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2034
            __SET_HASH(self, hash1);
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2035
        }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2036
        /*
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2037
         * my classes identityHash
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2038
         */
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2039
        o = __qClass(self);
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2040
        hash2 = __GET_HASH(o);
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2041
        if (hash2 == 0) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2042
            /* has no hash yet */
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2043
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2044
            if (++nextClassHash > __MAX_HASH__) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2045
                nextClassHash = 1;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2046
            }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2047
            hash2 = nextClassHash;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2048
            __SET_HASH(o, hash2);
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2049
        }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2050
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2051
        /*
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2052
         * some bits of my size
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2053
         */
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2054
        sz = __qSize(self);
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2055
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2056
        /*
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2057
         * now, we got 11 + 11 + 8 bits for hashing;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2058
         * make it as large as possible; since most hashers use the returned
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2059
         * key and take it modulo some prime number, this will allow for
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2060
         * better distribution (i.e. bigger empty spaces) in hashed collection.
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2061
         */
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2062
        hash = (hash1 << 11) | hash2;           /* 22 bits */
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2063
        hash = (hash << 8) | (sz & 0xFC);       /* 30 bits */
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2064
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2065
        while ((hash & 0x20000000) == 0) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2066
            hash <<= 1;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2067
        }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2068
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2069
        RETURN ( __mkSmallInteger(hash) );
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2070
    }
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2071
%}.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2072
    "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
  2073
    ^ self identityHash
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2074
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2075
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2076
sameContentsAs:anObject
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2077
    "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
  2078
     in both the named instance vars and any indexed instVars.
5ce61b826f0e sameContentsAs: comment.
Claus Gittinger <cg@exept.de>
parents: 7112
diff changeset
  2079
     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
  2080
     present in the arg, not vice versa.
5ce61b826f0e sameContentsAs: comment.
Claus Gittinger <cg@exept.de>
parents: 7112
diff changeset
  2081
     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
  2082
5821
c11bb6c8cc8f Cleanup unused method vars
Stefan Vogel <sv@exept.de>
parents: 5814
diff changeset
  2083
    |myClass
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2084
     sz "{ Class: SmallInteger }" |
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2085
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2086
    myClass := self class.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2087
    myClass isVariable ifTrue:[
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2088
        sz := self basicSize.
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2089
        anObject basicSize >= sz ifFalse:[^ false].
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2090
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2091
        "compare the indexed variables"
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2092
        1 to:sz do:[:i |
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2093
            (self basicAt:i) == (anObject basicAt:i) ifFalse:[^ false].
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2094
        ]
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2095
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2096
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2097
    "compare the instance variables"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2098
    sz := myClass instSize.
12997
11e3305c4a0c changed: #sameContentsAs:
sr
parents: 12841
diff changeset
  2099
    anObject class instSize >= sz ifFalse:[^ false].
7121
5ce61b826f0e sameContentsAs: comment.
Claus Gittinger <cg@exept.de>
parents: 7112
diff changeset
  2100
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  2101
    1 to:sz do:[:i |
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2102
        (self instVarAt:i) == (anObject instVarAt:i) ifFalse:[^ false].
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2103
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2104
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2105
    ^ true
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2106
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2107
    "
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  2108
     #(1 2 3 4) sameContentsAs:#[1 2 3 4] asArray
5814
f4f6da3e7631 Define #deepSameContentsAs:
Stefan Vogel <sv@exept.de>
parents: 5806
diff changeset
  2109
     (1@2) sameContentsAs:(1->2)
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2110
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2111
12997
11e3305c4a0c changed: #sameContentsAs:
sr
parents: 12841
diff changeset
  2112
    "Created: / 21-04-1998 / 15:56:40 / cg"
11e3305c4a0c changed: #sameContentsAs:
sr
parents: 12841
diff changeset
  2113
    "Modified: / 05-08-2010 / 16:44:09 / sr"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2114
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2115
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2116
~= anObject
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2117
    "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
  2118
     Notice:
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2119
        This method is partially open coded (inlined) by the compiler(s)
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2120
        identical objects are never considered unequal.
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2121
        redefining it may not work as expected."
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2122
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2123
    ^ (self = anObject) not
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2124
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2125
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2126
~~ anObject
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2127
    "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
  2128
     Never redefine this in any class.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2129
     Notice:
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2130
        This method is open coded (inlined) by the compiler(s)
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2131
        - redefining it may not work as expected."
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2132
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2133
%{  /* NOCONTEXT */
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2134
    RETURN ( (self == anObject) ? false : true );
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2135
%}
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2136
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2137
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2138
!Object methodsFor:'converting'!
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
-> anObject
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2141
    "return an association with the receiver as key and
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2142
     the argument as value"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2143
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2144
    ^ Association key:self value:anObject
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2145
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2146
10062
c84adfadde12 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10032
diff changeset
  2147
as:aSimilarClass
c84adfadde12 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10032
diff changeset
  2148
    "If the receivers class is not aSimilarClass,
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  2149
     create and return an object of class aSimilarClass that has the same contents
10062
c84adfadde12 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10032
diff changeset
  2150
     as the receiver.
c84adfadde12 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10032
diff changeset
  2151
     Otherwise, return the receiver."
c84adfadde12 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10032
diff changeset
  2152
c84adfadde12 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10032
diff changeset
  2153
    self class == aSimilarClass ifTrue:[^ self].
c84adfadde12 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10032
diff changeset
  2154
    ^ aSimilarClass newFrom:self
c84adfadde12 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10032
diff changeset
  2155
c84adfadde12 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10032
diff changeset
  2156
    "
c84adfadde12 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10032
diff changeset
  2157
     #[1 2 3 4] as:ByteArray
c84adfadde12 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10032
diff changeset
  2158
     #[1 2 3 4] as:Array
10539
05541b0358c2 changed #as: comment
Stefan Vogel <sv@exept.de>
parents: 10532
diff changeset
  2159
     #[81 82 83 84] as:String
05541b0358c2 changed #as: comment
Stefan Vogel <sv@exept.de>
parents: 10532
diff changeset
  2160
     #[81 82 83 84] as:Symbol
10062
c84adfadde12 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10032
diff changeset
  2161
    "
c84adfadde12 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10032
diff changeset
  2162
!
c84adfadde12 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10032
diff changeset
  2163
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2164
asCollection
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2165
    "return myself as a Collection.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2166
     Redefined in collection to return themself."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2167
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2168
    ^ Array with:self
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2169
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2170
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2171
asSequenceableCollection
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2172
    "return myself as a SequenceableCollection.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2173
     Redefined in SequenceableCollection"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2174
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2175
    ^ Array with:self
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2176
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2177
14355
b5ed6aa393f7 added: #asUnicode16String
Stefan Vogel <sv@exept.de>
parents: 14296
diff changeset
  2178
asString
b5ed6aa393f7 added: #asUnicode16String
Stefan Vogel <sv@exept.de>
parents: 14296
diff changeset
  2179
    ^ self printString
b5ed6aa393f7 added: #asUnicode16String
Stefan Vogel <sv@exept.de>
parents: 14296
diff changeset
  2180
!
b5ed6aa393f7 added: #asUnicode16String
Stefan Vogel <sv@exept.de>
parents: 14296
diff changeset
  2181
b5ed6aa393f7 added: #asUnicode16String
Stefan Vogel <sv@exept.de>
parents: 14296
diff changeset
  2182
asUnicode16String
b5ed6aa393f7 added: #asUnicode16String
Stefan Vogel <sv@exept.de>
parents: 14296
diff changeset
  2183
    ^ self asString asUnicode16String
b5ed6aa393f7 added: #asUnicode16String
Stefan Vogel <sv@exept.de>
parents: 14296
diff changeset
  2184
!
b5ed6aa393f7 added: #asUnicode16String
Stefan Vogel <sv@exept.de>
parents: 14296
diff changeset
  2185
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2186
asValue
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2187
    "return a valueHolder for for the receiver"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2188
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2189
    ^ ValueHolder with:self
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2190
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2191
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2192
!Object methodsFor:'copying'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2193
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  2194
cloneFrom:anObject
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2195
    "Helper for copy:
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2196
     copy all instance variables from anObject into the receiver,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2197
     which should be of the same class as the argument."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2198
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2199
    self cloneFrom:anObject performing:#yourself
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2200
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2201
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2202
     |x|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2203
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2204
     x := Array new:3.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2205
     x cloneFrom:#(1 2 3).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2206
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2207
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2208
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2209
cloneFrom:anObject performing:aSymbol
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2210
    "Helper for copy:
8383
dea5311899c5 comments in copy methods
Claus Gittinger <cg@exept.de>
parents: 8377
diff changeset
  2211
     for each instance variable from anObject, send it aSymbol
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2212
     and store the result into the receiver,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2213
     which should be of the same class as the argument."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2214
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2215
    |myClass sz "{ Class: SmallInteger }" t |
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2216
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2217
    myClass := self class.
14532
f15633aab0fe class: Object
Stefan Vogel <sv@exept.de>
parents: 14527
diff changeset
  2218
f15633aab0fe class: Object
Stefan Vogel <sv@exept.de>
parents: 14527
diff changeset
  2219
    "process the named instance variables"
f15633aab0fe class: Object
Stefan Vogel <sv@exept.de>
parents: 14527
diff changeset
  2220
    sz := myClass instSize.
f15633aab0fe class: Object
Stefan Vogel <sv@exept.de>
parents: 14527
diff changeset
  2221
    1 to:sz do:[:i |
f15633aab0fe class: Object
Stefan Vogel <sv@exept.de>
parents: 14527
diff changeset
  2222
        t := anObject instVarAt:i.
f15633aab0fe class: Object
Stefan Vogel <sv@exept.de>
parents: 14527
diff changeset
  2223
        aSymbol ~~ #yourself ifTrue:[
f15633aab0fe class: Object
Stefan Vogel <sv@exept.de>
parents: 14527
diff changeset
  2224
            t := t perform:aSymbol
f15633aab0fe class: Object
Stefan Vogel <sv@exept.de>
parents: 14527
diff changeset
  2225
        ].
f15633aab0fe class: Object
Stefan Vogel <sv@exept.de>
parents: 14527
diff changeset
  2226
        self instVarAt:i put:t
f15633aab0fe class: Object
Stefan Vogel <sv@exept.de>
parents: 14527
diff changeset
  2227
    ].
f15633aab0fe class: Object
Stefan Vogel <sv@exept.de>
parents: 14527
diff changeset
  2228
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2229
    myClass isVariable ifTrue:[
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2230
        sz := self basicSize.
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2231
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2232
        "process the indexed instance variables"
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2233
        1 to:sz do:[:i |
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2234
            t := anObject basicAt:i.
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2235
            aSymbol ~~ #yourself ifTrue:[
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2236
                t := t perform:aSymbol.
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2237
            ].
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2238
            self basicAt:i put:t.
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2239
        ]
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2240
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2241
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2242
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2243
cloneInstanceVariablesFrom:aPrototype
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2244
    "Shallow copy variables from a prototype into myself.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2245
     This copies instVars by name - i.e. same-named variables are
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2246
     copied, others are not.
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  2247
     The variable slots are copied as available
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2248
     (i.e. the min of both indexed sizes is used)."
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  2249
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2250
    |myInfo otherInfo|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2251
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2252
    myInfo := self class instanceVariableOffsets.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2253
    otherInfo := aPrototype class instanceVariableOffsets.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2254
    myInfo keysAndValuesDo:[:name :index | |varIndexAssoc|
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2255
        varIndexAssoc := otherInfo at:name ifAbsent:[].
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2256
        varIndexAssoc notNil ifTrue:[
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2257
            self instVarAt:index put:(aPrototype instVarAt:(varIndexAssoc value))
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2258
        ]
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2259
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2260
    self isVariable ifTrue:[
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2261
        1 to:(self basicSize min:aPrototype basicSize) do:[:index |
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2262
            self basicAt:index put:(aPrototype basicAt:index)
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2263
        ].
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2264
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2265
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2266
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2267
     Class withoutUpdatingChangesDo:[
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2268
         Point subclass:#Point3D
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2269
           instanceVariableNames:'z'
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2270
           classVariableNames:''
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2271
           poolDictionaries:''
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2272
           category:'testing'.
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2273
         (Point3D new cloneInstanceVariablesFrom:1@2) inspect.
5755
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
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2276
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2277
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2278
     Class withoutUpdatingChangesDo:[
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2279
         Point variableSubclass:#Point3D
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2280
           instanceVariableNames:'z'
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2281
           classVariableNames:''
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2282
           poolDictionaries:''
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2283
           category:'testing'.
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2284
         ((Point3D new:2) cloneInstanceVariablesFrom:#(1 2 3)) inspect.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2285
     ]
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2286
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2287
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2288
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2289
     |someObject|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2290
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2291
     Class withoutUpdatingChangesDo:[
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2292
         Object subclass:#TestClass1
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2293
           instanceVariableNames:'foo bar'
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2294
           classVariableNames:''
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2295
           poolDictionaries:''
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2296
           category:'testing'.
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2297
         someObject := TestClass1 new.
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2298
         someObject instVarAt:1 put:'foo'; instVarAt:2 put:'bar'.
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2299
         Object subclass:#TestClass2
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2300
           instanceVariableNames:'bar foo'
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2301
           classVariableNames:''
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2302
           poolDictionaries:''
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2303
           category:'testing'.
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2304
         (TestClass2 new cloneInstanceVariablesFrom:someObject) inspect.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2305
     ]
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2306
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2307
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2308
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2309
     |top b b1|
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
     top := StandardSystemView new.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2312
     top extent:100@100.
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
     b := Button in:top.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2315
     b label:'hello'.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2316
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2317
     b1 := ArrowButton new cloneInstanceVariablesFrom:b.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2318
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2319
     top open.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2320
     b1 inspect
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2321
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2322
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2323
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2324
copy
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2325
    "return a copy of the receiver - defaults to shallowcopy here.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2326
     Notice, that copy does not copy dependents."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2327
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2328
    ^ self shallowCopy postCopy
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2329
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2330
6146
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
  2331
copyToLevel:level
6962
eab0d4c42375 copyToLevel: example and comment
Claus Gittinger <cg@exept.de>
parents: 6961
diff changeset
  2332
    "a controlled deepCopy, where the number of levels can be specified.
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  2333
     Notice:
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2334
         This method DOES NOT handle cycles/self-refs and does NOT preserve object identity;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2335
         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
  2336
eab0d4c42375 copyToLevel: example and comment
Claus Gittinger <cg@exept.de>
parents: 6961
diff changeset
  2337
    |newObject class index|
6146
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
  2338
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
  2339
    level == 1 ifTrue:[^ self shallowCopy].
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
  2340
6962
eab0d4c42375 copyToLevel: example and comment
Claus Gittinger <cg@exept.de>
parents: 6961
diff changeset
  2341
    class := self class.
eab0d4c42375 copyToLevel: example and comment
Claus Gittinger <cg@exept.de>
parents: 6961
diff changeset
  2342
    newObject := self clone.
6146
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
  2343
    newObject == self ifTrue: [^ self].
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  2344
    class isVariable ifTrue:[
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2345
        index := self basicSize.
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2346
        [index > 0] whileTrue:[
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2347
            newObject basicAt: index put: ((self basicAt: index) copyToLevel:(level-1)).
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2348
            index := index - 1
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2349
        ]
6962
eab0d4c42375 copyToLevel: example and comment
Claus Gittinger <cg@exept.de>
parents: 6961
diff changeset
  2350
    ].
eab0d4c42375 copyToLevel: example and comment
Claus Gittinger <cg@exept.de>
parents: 6961
diff changeset
  2351
    index := class instSize.
eab0d4c42375 copyToLevel: example and comment
Claus Gittinger <cg@exept.de>
parents: 6961
diff changeset
  2352
    [index > 0] whileTrue:[
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2353
        newObject instVarAt: index put: ((self instVarAt: index) copyToLevel:(level-1)).
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2354
        index := index - 1
6962
eab0d4c42375 copyToLevel: example and comment
Claus Gittinger <cg@exept.de>
parents: 6961
diff changeset
  2355
    ].
eab0d4c42375 copyToLevel: example and comment
Claus Gittinger <cg@exept.de>
parents: 6961
diff changeset
  2356
    ^ newObject
eab0d4c42375 copyToLevel: example and comment
Claus Gittinger <cg@exept.de>
parents: 6961
diff changeset
  2357
eab0d4c42375 copyToLevel: example and comment
Claus Gittinger <cg@exept.de>
parents: 6961
diff changeset
  2358
    "
eab0d4c42375 copyToLevel: example and comment
Claus Gittinger <cg@exept.de>
parents: 6961
diff changeset
  2359
     |a b|
eab0d4c42375 copyToLevel: example and comment
Claus Gittinger <cg@exept.de>
parents: 6961
diff changeset
  2360
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  2361
     a := #(
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2362
            '1.1'
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2363
            '1.2'
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2364
            '1.3'
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2365
            (
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2366
                '1.41'
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2367
                '1.42'
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2368
                '1.43'
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2369
                    (
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2370
                        '1.441'
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2371
                        '1.442'
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2372
                        '1.443'
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2373
                        ( '1.4441' '1.4442' '1.4443' )
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2374
                        '1.445'
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2375
                    )
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2376
                '1.45'
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2377
            )
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2378
            '1.5'
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2379
           ).
6962
eab0d4c42375 copyToLevel: example and comment
Claus Gittinger <cg@exept.de>
parents: 6961
diff changeset
  2380
eab0d4c42375 copyToLevel: example and comment
Claus Gittinger <cg@exept.de>
parents: 6961
diff changeset
  2381
      b := a copyToLevel:1.
eab0d4c42375 copyToLevel: example and comment
Claus Gittinger <cg@exept.de>
parents: 6961
diff changeset
  2382
      self assert: ( (a at:1) == (b at:1) ).
eab0d4c42375 copyToLevel: example and comment
Claus Gittinger <cg@exept.de>
parents: 6961
diff changeset
  2383
      self assert: ( (a at:4) == (b at:4) ).
eab0d4c42375 copyToLevel: example and comment
Claus Gittinger <cg@exept.de>
parents: 6961
diff changeset
  2384
eab0d4c42375 copyToLevel: example and comment
Claus Gittinger <cg@exept.de>
parents: 6961
diff changeset
  2385
      b := a copyToLevel:2.
eab0d4c42375 copyToLevel: example and comment
Claus Gittinger <cg@exept.de>
parents: 6961
diff changeset
  2386
      self assert: ( (a at:1) ~~ (b at:1) ).
eab0d4c42375 copyToLevel: example and comment
Claus Gittinger <cg@exept.de>
parents: 6961
diff changeset
  2387
      self assert: ( (a at:4) ~~ (b at:4) ).
eab0d4c42375 copyToLevel: example and comment
Claus Gittinger <cg@exept.de>
parents: 6961
diff changeset
  2388
      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
  2389
      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
  2390
eab0d4c42375 copyToLevel: example and comment
Claus Gittinger <cg@exept.de>
parents: 6961
diff changeset
  2391
      b := a copyToLevel:3.
eab0d4c42375 copyToLevel: example and comment
Claus Gittinger <cg@exept.de>
parents: 6961
diff changeset
  2392
      self assert: ( (a at:1) ~~ (b at:1) ).
eab0d4c42375 copyToLevel: example and comment
Claus Gittinger <cg@exept.de>
parents: 6961
diff changeset
  2393
      self assert: ( (a at:4) ~~ (b at:4) ).
eab0d4c42375 copyToLevel: example and comment
Claus Gittinger <cg@exept.de>
parents: 6961
diff changeset
  2394
      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
  2395
      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
  2396
      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
  2397
      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
  2398
    "
6146
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
  2399
!
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
  2400
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2401
deepCopy
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2402
    "return a copy of the object with all subobjects also copied.
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  2403
     This method DOES handle cycles/self-refs and preserves object identity;
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2404
     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
  2405
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2406
     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
  2407
     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
  2408
     copied object does not include duplicates (or you do not care) and
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  2409
     no cycles are involved, you can use the old simpleDeepCopy,
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2410
     which avoids this overhead (but may run into trouble).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2411
     Notice, that deepCopy does not copy dependents."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2412
8383
dea5311899c5 comments in copy methods
Claus Gittinger <cg@exept.de>
parents: 8377
diff changeset
  2413
    ^ self deepCopyUsing:(IdentityDictionary new)
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2414
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2415
    "an example which is not handled by the old deepCopy:
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  2416
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2417
     |a|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2418
     a := Array new:3.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2419
     a at:3 put:a.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2420
     a deepCopy inspect
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2421
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2422
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2423
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2424
     |a|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2425
     a := Color black onDevice:Screen current.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2426
     a deepCopy inspect
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2427
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2428
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2429
    "Modified: 27.3.1996 / 16:31:20 / stefan"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2430
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2431
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2432
deepCopyError
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2433
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2434
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2435
    "raise a signal, that deepCopy is not allowed for this object"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2436
8330
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
  2437
    ^ DeepCopyError raise
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2438
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2439
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2440
deepCopyUsing:aDictionary
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  2441
    "a helper for deepCopy; return a copy of the object with
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  2442
     all subobjects also copied. If the to-be-copied object is in the dictionary,
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2443
     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
  2444
     This method DOES handle cycles/self references."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2445
10941
f80dfc67dc51 deepCopy change
ab
parents: 10922
diff changeset
  2446
    ^ self deepCopyUsing:aDictionary postCopySelector:#postDeepCopyFrom:.
f80dfc67dc51 deepCopy change
ab
parents: 10922
diff changeset
  2447
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2448
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2449
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2450
     |a b c copyOfC|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2451
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2452
     a := Array with:'hello' with:'world' with:nil.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2453
     b := 99 @ 999.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2454
     a at:3 put:b.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2455
     c := Array with:a with:b with:a.
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
     Transcript showCR: (c at:1) == (c at:3).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2458
     copyOfC := c deepCopy.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2459
     Transcript showCR: (copyOfC at:1) == (copyOfC at:3)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2460
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2461
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2462
10954
b0d7bbc8673d deepCopyUsing:postCopySelector: in libbasic
sr
parents: 10941
diff changeset
  2463
deepCopyUsing:aDictionary postCopySelector:postCopySelector
11335
c061d08b766f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11314
diff changeset
  2464
    "a helper for deepCopy; return a copy of the object with
c061d08b766f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11314
diff changeset
  2465
     all subobjects also copied. If the to-be-copied object is in the dictionary,
10954
b0d7bbc8673d deepCopyUsing:postCopySelector: in libbasic
sr
parents: 10941
diff changeset
  2466
     use the value found there. The class of the receiver is not copied.
b0d7bbc8673d deepCopyUsing:postCopySelector: in libbasic
sr
parents: 10941
diff changeset
  2467
     This method DOES handle cycles/self references."
b0d7bbc8673d deepCopyUsing:postCopySelector: in libbasic
sr
parents: 10941
diff changeset
  2468
b0d7bbc8673d deepCopyUsing:postCopySelector: in libbasic
sr
parents: 10941
diff changeset
  2469
    |myClass aCopy
14527
b933e9f1e53d class: Object
Stefan Vogel <sv@exept.de>
parents: 14499
diff changeset
  2470
     basicSize "{ Class: SmallInteger }"
b933e9f1e53d class: Object
Stefan Vogel <sv@exept.de>
parents: 14499
diff changeset
  2471
     instSize  "{ Class: SmallInteger }"
10954
b0d7bbc8673d deepCopyUsing:postCopySelector: in libbasic
sr
parents: 10941
diff changeset
  2472
     iOrig iCopy|
b0d7bbc8673d deepCopyUsing:postCopySelector: in libbasic
sr
parents: 10941
diff changeset
  2473
b0d7bbc8673d deepCopyUsing:postCopySelector: in libbasic
sr
parents: 10941
diff changeset
  2474
    myClass := self class.
b0d7bbc8673d deepCopyUsing:postCopySelector: in libbasic
sr
parents: 10941
diff changeset
  2475
    myClass isVariable ifTrue:[
14527
b933e9f1e53d class: Object
Stefan Vogel <sv@exept.de>
parents: 14499
diff changeset
  2476
        basicSize := self basicSize.
b933e9f1e53d class: Object
Stefan Vogel <sv@exept.de>
parents: 14499
diff changeset
  2477
        aCopy := myClass basicNew:basicSize.
10954
b0d7bbc8673d deepCopyUsing:postCopySelector: in libbasic
sr
parents: 10941
diff changeset
  2478
    ] ifFalse:[
14527
b933e9f1e53d class: Object
Stefan Vogel <sv@exept.de>
parents: 14499
diff changeset
  2479
        basicSize := 0.
13515
2c1e968842cb changed: #deepCopyUsing:postCopySelector:
Claus Gittinger <cg@exept.de>
parents: 13500
diff changeset
  2480
        aCopy := myClass basicNew
10954
b0d7bbc8673d deepCopyUsing:postCopySelector: in libbasic
sr
parents: 10941
diff changeset
  2481
    ].
b0d7bbc8673d deepCopyUsing:postCopySelector: in libbasic
sr
parents: 10941
diff changeset
  2482
    aCopy setHashFrom:self.
b0d7bbc8673d deepCopyUsing:postCopySelector: in libbasic
sr
parents: 10941
diff changeset
  2483
    aDictionary at:self put:aCopy.
b0d7bbc8673d deepCopyUsing:postCopySelector: in libbasic
sr
parents: 10941
diff changeset
  2484
b0d7bbc8673d deepCopyUsing:postCopySelector: in libbasic
sr
parents: 10941
diff changeset
  2485
    "
14527
b933e9f1e53d class: Object
Stefan Vogel <sv@exept.de>
parents: 14499
diff changeset
  2486
     copy the instance variables
b933e9f1e53d class: Object
Stefan Vogel <sv@exept.de>
parents: 14499
diff changeset
  2487
    "
b933e9f1e53d class: Object
Stefan Vogel <sv@exept.de>
parents: 14499
diff changeset
  2488
    instSize := myClass instSize.
b933e9f1e53d class: Object
Stefan Vogel <sv@exept.de>
parents: 14499
diff changeset
  2489
    1 to:instSize do:[:i |
b933e9f1e53d class: Object
Stefan Vogel <sv@exept.de>
parents: 14499
diff changeset
  2490
        (self skipInstvarIndexInDeepCopy:i) ifFalse:[
b933e9f1e53d class: Object
Stefan Vogel <sv@exept.de>
parents: 14499
diff changeset
  2491
            iOrig := self instVarAt:i.
b933e9f1e53d class: Object
Stefan Vogel <sv@exept.de>
parents: 14499
diff changeset
  2492
            iOrig notNil ifTrue:[
b933e9f1e53d class: Object
Stefan Vogel <sv@exept.de>
parents: 14499
diff changeset
  2493
                iCopy := aDictionary at:iOrig ifAbsent:nil.
b933e9f1e53d class: Object
Stefan Vogel <sv@exept.de>
parents: 14499
diff changeset
  2494
                iCopy isNil ifTrue:[
b933e9f1e53d class: Object
Stefan Vogel <sv@exept.de>
parents: 14499
diff changeset
  2495
                    iCopy := iOrig deepCopyUsing:aDictionary postCopySelector:postCopySelector
b933e9f1e53d class: Object
Stefan Vogel <sv@exept.de>
parents: 14499
diff changeset
  2496
                ].
b933e9f1e53d class: Object
Stefan Vogel <sv@exept.de>
parents: 14499
diff changeset
  2497
                aCopy instVarAt:i put:iCopy
b933e9f1e53d class: Object
Stefan Vogel <sv@exept.de>
parents: 14499
diff changeset
  2498
            ]
b933e9f1e53d class: Object
Stefan Vogel <sv@exept.de>
parents: 14499
diff changeset
  2499
        ]
b933e9f1e53d class: Object
Stefan Vogel <sv@exept.de>
parents: 14499
diff changeset
  2500
    ].
b933e9f1e53d class: Object
Stefan Vogel <sv@exept.de>
parents: 14499
diff changeset
  2501
b933e9f1e53d class: Object
Stefan Vogel <sv@exept.de>
parents: 14499
diff changeset
  2502
    "
10954
b0d7bbc8673d deepCopyUsing:postCopySelector: in libbasic
sr
parents: 10941
diff changeset
  2503
     copy indexed instvars - if any
b0d7bbc8673d deepCopyUsing:postCopySelector: in libbasic
sr
parents: 10941
diff changeset
  2504
    "
14527
b933e9f1e53d class: Object
Stefan Vogel <sv@exept.de>
parents: 14499
diff changeset
  2505
    basicSize ~~ 0 ifTrue:[
13515
2c1e968842cb changed: #deepCopyUsing:postCopySelector:
Claus Gittinger <cg@exept.de>
parents: 13500
diff changeset
  2506
        myClass isBits ifTrue:[
2c1e968842cb changed: #deepCopyUsing:postCopySelector:
Claus Gittinger <cg@exept.de>
parents: 13500
diff changeset
  2507
            "block-copy indexed instvars"
14527
b933e9f1e53d class: Object
Stefan Vogel <sv@exept.de>
parents: 14499
diff changeset
  2508
            aCopy replaceFrom:1 to:basicSize with:self startingAt:1
13515
2c1e968842cb changed: #deepCopyUsing:postCopySelector:
Claus Gittinger <cg@exept.de>
parents: 13500
diff changeset
  2509
        ] ifFalse:[
2c1e968842cb changed: #deepCopyUsing:postCopySelector:
Claus Gittinger <cg@exept.de>
parents: 13500
diff changeset
  2510
            "individual deep copy the indexed variables"
14527
b933e9f1e53d class: Object
Stefan Vogel <sv@exept.de>
parents: 14499
diff changeset
  2511
            1 to:basicSize do:[:i |
13515
2c1e968842cb changed: #deepCopyUsing:postCopySelector:
Claus Gittinger <cg@exept.de>
parents: 13500
diff changeset
  2512
                iOrig := self basicAt:i.
2c1e968842cb changed: #deepCopyUsing:postCopySelector:
Claus Gittinger <cg@exept.de>
parents: 13500
diff changeset
  2513
                iOrig notNil ifTrue:[
2c1e968842cb changed: #deepCopyUsing:postCopySelector:
Claus Gittinger <cg@exept.de>
parents: 13500
diff changeset
  2514
                    "/ used to be dict-includesKey-ifTrue[dict-at:],
2c1e968842cb changed: #deepCopyUsing:postCopySelector:
Claus Gittinger <cg@exept.de>
parents: 13500
diff changeset
  2515
                    "/ changed to use dict-at:ifAbsent:, to avoid double lookup in dictionary
2c1e968842cb changed: #deepCopyUsing:postCopySelector:
Claus Gittinger <cg@exept.de>
parents: 13500
diff changeset
  2516
                    iCopy := aDictionary at:iOrig ifAbsent:nil.
2c1e968842cb changed: #deepCopyUsing:postCopySelector:
Claus Gittinger <cg@exept.de>
parents: 13500
diff changeset
  2517
                    iCopy isNil ifTrue:[
2c1e968842cb changed: #deepCopyUsing:postCopySelector:
Claus Gittinger <cg@exept.de>
parents: 13500
diff changeset
  2518
                        iCopy := iOrig deepCopyUsing:aDictionary postCopySelector:postCopySelector
2c1e968842cb changed: #deepCopyUsing:postCopySelector:
Claus Gittinger <cg@exept.de>
parents: 13500
diff changeset
  2519
                    ].
2c1e968842cb changed: #deepCopyUsing:postCopySelector:
Claus Gittinger <cg@exept.de>
parents: 13500
diff changeset
  2520
                    aCopy basicAt:i put:iCopy
2c1e968842cb changed: #deepCopyUsing:postCopySelector:
Claus Gittinger <cg@exept.de>
parents: 13500
diff changeset
  2521
                ]
2c1e968842cb changed: #deepCopyUsing:postCopySelector:
Claus Gittinger <cg@exept.de>
parents: 13500
diff changeset
  2522
            ]
2c1e968842cb changed: #deepCopyUsing:postCopySelector:
Claus Gittinger <cg@exept.de>
parents: 13500
diff changeset
  2523
        ]
10954
b0d7bbc8673d deepCopyUsing:postCopySelector: in libbasic
sr
parents: 10941
diff changeset
  2524
    ].
b0d7bbc8673d deepCopyUsing:postCopySelector: in libbasic
sr
parents: 10941
diff changeset
  2525
13515
2c1e968842cb changed: #deepCopyUsing:postCopySelector:
Claus Gittinger <cg@exept.de>
parents: 13500
diff changeset
  2526
    aCopy perform:postCopySelector withOptionalArgument:self and:aDictionary.
10954
b0d7bbc8673d deepCopyUsing:postCopySelector: in libbasic
sr
parents: 10941
diff changeset
  2527
    ^ aCopy
13515
2c1e968842cb changed: #deepCopyUsing:postCopySelector:
Claus Gittinger <cg@exept.de>
parents: 13500
diff changeset
  2528
2c1e968842cb changed: #deepCopyUsing:postCopySelector:
Claus Gittinger <cg@exept.de>
parents: 13500
diff changeset
  2529
    "Modified: / 21-07-2011 / 13:30:52 / cg"
10954
b0d7bbc8673d deepCopyUsing:postCopySelector: in libbasic
sr
parents: 10941
diff changeset
  2530
!
b0d7bbc8673d deepCopyUsing:postCopySelector: in libbasic
sr
parents: 10941
diff changeset
  2531
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2532
postCopy
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2533
    "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
  2534
     cleanup after copying, while ST/X passes the original in postCopyFrom:
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2535
     (see there)"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2536
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2537
    ^ self
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2538
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2539
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2540
postDeepCopy
8930
edd42af66c0a deepCopy should not invoke postCopy
Claus Gittinger <cg@exept.de>
parents: 8913
diff changeset
  2541
    "allows for cleanup after deep copying.
edd42af66c0a deepCopy should not invoke postCopy
Claus Gittinger <cg@exept.de>
parents: 8913
diff changeset
  2542
     To be redefined in subclasses."
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2543
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2544
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2545
postDeepCopyFrom:aSource
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2546
    "allows for cleanup after deep copying"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2547
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2548
    ^ self postDeepCopy
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2549
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2550
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2551
setHashFrom:anObject
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  2552
    "set my identity-hash key to be the same as anObjects hash key.
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  2553
     This is an ST/X speciality, which is NOT available in other (especially OT based)
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2554
     Smalltalks, and may not be available in future ST/X versions.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2555
     DO NEVER use this for normal application code."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2556
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2557
%{  /* NOCONTEXT */
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2558
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2559
    REGISTER unsigned h;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2560
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2561
    if (__isNonNilObject(self) && __isNonNilObject(anObject)) {
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2562
        h = __GET_HASH(anObject);
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2563
        __SET_HASH(self, h);
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2564
        RETURN (self);
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2565
    }
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2566
%}.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2567
    self primitiveFailed    "neither receiver not arg may be nil or SmallInteger"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2568
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2569
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2570
shallowCopy
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2571
    "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
  2572
     i.e. the copy shares referenced instvars with its original."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2573
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2574
%{  /* NOCONTEXT */
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2575
    int ninsts, spc;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2576
    int sz;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2577
    OBJ theCopy;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2578
    OBJ cls;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2579
    int flags;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2580
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2581
    cls = __qClass(self);
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2582
    flags = __intVal(__ClassInstPtr(cls)->c_flags);
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2583
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2584
    /*
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2585
     * bail out for special objects ..
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2586
     */
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2587
    if (((flags & ~ARRAYMASK) == 0)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2588
     && ((flags & ARRAYMASK) != WKPOINTERARRAY)) {
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2589
        sz = __qSize(self);
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2590
        __PROTECT__(self);
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2591
        __qNew(theCopy, sz);    /* OBJECT ALLOCATION */
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2592
        __UNPROTECT__(self);
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2593
        if (theCopy) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2594
            cls = __qClass(self);
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2595
            spc = __qSpace(theCopy);
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2596
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2597
            theCopy->o_class = cls; __STORE_SPC(theCopy, cls, spc);
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2598
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2599
            sz = sz - OHDR_SIZE;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2600
            if (sz) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2601
                char *src, *dst;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2602
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2603
                src = (char *)(__InstPtr(self)->i_instvars);
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2604
                dst = (char *)(__InstPtr(theCopy)->i_instvars);
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2605
#ifdef bcopy4
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2606
                {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2607
                    /* care for odd-number of longs */
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2608
                    int nW = sz >> 2;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2609
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2610
                    if (sz & 3) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2611
                        nW++;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2612
                    }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2613
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2614
                    bcopy4(src, dst, nW);
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2615
                }
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2616
#else
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2617
                bcopy(src, dst, sz);
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2618
#endif
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2619
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2620
                flags &= ARRAYMASK;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2621
                if (flags == POINTERARRAY) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2622
                    ninsts = __BYTES2OBJS__(sz);
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2623
                } else {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2624
                    ninsts = __intVal(__ClassInstPtr(cls)->c_ninstvars);
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2625
                }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2626
                if (ninsts) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2627
                    do {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2628
                        OBJ el;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2629
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2630
                        el = __InstPtr(theCopy)->i_instvars[ninsts-1];
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2631
                        __STORE_SPC(theCopy, el, spc);
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2632
                    } while (--ninsts);
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2633
                }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2634
            }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2635
            RETURN (theCopy);
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2636
        }
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2637
    }
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2638
%}.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2639
    "/ fallBack for special objects & memoryAllocation failure case
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
    ^ self slowShallowCopy
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2642
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2643
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2644
simpleDeepCopy
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2645
    "return a copy of the object with all subobjects also copied.
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  2646
     This method does NOT handle cycles - but is included to allow this
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2647
     slightly faster copy in situations where it is known that
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2648
     no recursive references occur (LargeIntegers for example).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2649
     NOTICE: you will run into trouble, when trying this with recursive
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2650
     objects (usually recursionInterrupt or memory-alert).
8383
dea5311899c5 comments in copy methods
Claus Gittinger <cg@exept.de>
parents: 8377
diff changeset
  2651
     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
  2652
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2653
    |myClass aCopy|
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
    (myClass := self class) isVariable ifTrue:[
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2656
        aCopy := myClass basicNew:(self basicSize).
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2657
    ] ifFalse:[
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2658
        aCopy := myClass basicNew
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2659
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2660
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2661
    "copy the instance variables"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2662
    aCopy cloneFrom:self performing:#simpleDeepCopy.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2663
    ^ aCopy
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2664
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2665
    "a bad example (but ST/X should survive ...)"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2666
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2667
     |a|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2668
     a := Array new:3.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2669
     a at:3 put:a.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2670
     a simpleDeepCopy
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2671
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2672
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2673
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2674
skipInstvarIndexInDeepCopy:index
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2675
    "a helper for deepCopy; only indices for which this method returns
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2676
     false are copied in a deep copy.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2677
     The default is false here - which means that everything is copied.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2678
     Can be redefined in subclasses for partial copies"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2679
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2680
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2681
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2682
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2683
slowShallowCopy
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2684
    "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
  2685
     i.e. the copy shares referenced instvars with its original.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2686
     This method is only invoked as a fallback from #shallowCopy."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2687
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2688
    |myClass aCopy|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2689
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2690
    (myClass := self class) isVariable ifTrue:[
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2691
        aCopy := myClass basicNew:(self basicSize).
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2692
    ] ifFalse:[
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2693
        aCopy := myClass basicNew
5755
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
    "copy the instance variables"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2697
    aCopy cloneFrom:self performing:#yourself.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2698
    ^ aCopy
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2699
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2700
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2701
!Object methodsFor:'debugging'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2702
7621
42fb582ea36b allow for blocks in assert
Claus Gittinger <cg@exept.de>
parents: 7600
diff changeset
  2703
assert:aBooleanOrBlock
13800
2f04da6f127e comment/format in: #assert:
Stefan Vogel <sv@exept.de>
parents: 13710
diff changeset
  2704
    "fail and report an error, if the argument does not evaluate to true"
6964
a9ecdb3f1e52 comments
Claus Gittinger <cg@exept.de>
parents: 6963
diff changeset
  2705
11662
08309a406658 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11634
diff changeset
  2706
    "{ Pragma: +optSpace }"
08309a406658 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11634
diff changeset
  2707
11021
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  2708
    <resource: #skipInDebuggersWalkBack>
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  2709
8876
dc094269db8e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8872
diff changeset
  2710
    aBooleanOrBlock == true ifTrue:[^ self].
11141
b96ed3ac5825 assertions can be globally disabled
Claus Gittinger <cg@exept.de>
parents: 11132
diff changeset
  2711
    (Smalltalk at:#IgnoreAssertion ifAbsent:false) == true ifTrue:[^ self].
11044
fa13d9423e71 allow for encounteredBreakPoints to be monitored
Claus Gittinger <cg@exept.de>
parents: 11025
diff changeset
  2712
8876
dc094269db8e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8872
diff changeset
  2713
    "/ could still be a block or false.
11662
08309a406658 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11634
diff changeset
  2714
    (aBooleanOrBlock value) ifFalse:[
13800
2f04da6f127e comment/format in: #assert:
Stefan Vogel <sv@exept.de>
parents: 13710
diff changeset
  2715
        AssertionFailedError
2f04da6f127e comment/format in: #assert:
Stefan Vogel <sv@exept.de>
parents: 13710
diff changeset
  2716
            raiseRequestWith:self
2f04da6f127e comment/format in: #assert:
Stefan Vogel <sv@exept.de>
parents: 13710
diff changeset
  2717
            errorString:('Assertion failed in ',
2f04da6f127e comment/format in: #assert:
Stefan Vogel <sv@exept.de>
parents: 13710
diff changeset
  2718
                         thisContext sender printString,
2f04da6f127e comment/format in: #assert:
Stefan Vogel <sv@exept.de>
parents: 13710
diff changeset
  2719
                         '[', thisContext sender lineNumber printString,']')
11662
08309a406658 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11634
diff changeset
  2720
    ].
08309a406658 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11634
diff changeset
  2721
08309a406658 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11634
diff changeset
  2722
    "
08309a406658 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11634
diff changeset
  2723
     self assert:false
08309a406658 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11634
diff changeset
  2724
    "
13039
43313704ee61 changed: #assert:
Claus Gittinger <cg@exept.de>
parents: 12997
diff changeset
  2725
43313704ee61 changed: #assert:
Claus Gittinger <cg@exept.de>
parents: 12997
diff changeset
  2726
    "Modified: / 20-08-2010 / 17:13:06 / cg"
7621
42fb582ea36b allow for blocks in assert
Claus Gittinger <cg@exept.de>
parents: 7600
diff changeset
  2727
!
42fb582ea36b allow for blocks in assert
Claus Gittinger <cg@exept.de>
parents: 7600
diff changeset
  2728
42fb582ea36b allow for blocks in assert
Claus Gittinger <cg@exept.de>
parents: 7600
diff changeset
  2729
assert:aBooleanOrBlock message:messageIfFailing
11044
fa13d9423e71 allow for encounteredBreakPoints to be monitored
Claus Gittinger <cg@exept.de>
parents: 11025
diff changeset
  2730
    "fail, if the argument does not evaluate to true and report an error"
6961
096ca5ceb662 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6954
diff changeset
  2731
096ca5ceb662 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6954
diff changeset
  2732
    "{ Pragma: +optSpace }"
096ca5ceb662 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6954
diff changeset
  2733
11021
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  2734
    <resource: #skipInDebuggersWalkBack>
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  2735
11141
b96ed3ac5825 assertions can be globally disabled
Claus Gittinger <cg@exept.de>
parents: 11132
diff changeset
  2736
    aBooleanOrBlock == true ifTrue:[^ self].
b96ed3ac5825 assertions can be globally disabled
Claus Gittinger <cg@exept.de>
parents: 11132
diff changeset
  2737
    (Smalltalk at:#IgnoreAssertion ifAbsent:false) == true ifTrue:[^ self].
b96ed3ac5825 assertions can be globally disabled
Claus Gittinger <cg@exept.de>
parents: 11132
diff changeset
  2738
7621
42fb582ea36b allow for blocks in assert
Claus Gittinger <cg@exept.de>
parents: 7600
diff changeset
  2739
    (aBooleanOrBlock value) ifFalse:[
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2740
        AssertionFailedError
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2741
            raiseRequestWith:self
14046
541f46216cb4 added: #disableAllBreakPoints
Claus Gittinger <cg@exept.de>
parents: 13990
diff changeset
  2742
            errorString:(messageIfFailing, ' {',thisContext sender "methodHome" printString,' }')
11662
08309a406658 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11634
diff changeset
  2743
    ].
08309a406658 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11634
diff changeset
  2744
08309a406658 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11634
diff changeset
  2745
    "
08309a406658 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11634
diff changeset
  2746
     self assert:false message:'xxx'
10651
b205dbfea7e5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10576
diff changeset
  2747
    "
14046
541f46216cb4 added: #disableAllBreakPoints
Claus Gittinger <cg@exept.de>
parents: 13990
diff changeset
  2748
541f46216cb4 added: #disableAllBreakPoints
Claus Gittinger <cg@exept.de>
parents: 13990
diff changeset
  2749
    "Modified (comment): / 06-03-2012 / 11:26:48 / cg"
6961
096ca5ceb662 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6954
diff changeset
  2750
!
096ca5ceb662 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6954
diff changeset
  2751
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2752
basicInspect
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2753
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2754
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2755
    "launch an inspector on the receiver.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2756
     this method should NOT be redefined in subclasses."
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
    Inspector isNil ifTrue:[
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2759
        "
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2760
         for systems without GUI
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2761
        "
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2762
        self warn:'No Inspector defined (Inspector is nil).'
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2763
    ] ifFalse:[
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2764
        Inspector openOn:self
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2765
    ]
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2766
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2767
    "Modified: 18.5.1996 / 15:43:25 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2768
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2769
11025
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  2770
breakPoint:someKey
6954
c3408e945eb5 oops - breakpoint lost
Claus Gittinger <cg@exept.de>
parents: 6950
diff changeset
  2771
    "{ Pragma: +optSpace }"
c3408e945eb5 oops - breakpoint lost
Claus Gittinger <cg@exept.de>
parents: 6950
diff changeset
  2772
c3408e945eb5 oops - breakpoint lost
Claus Gittinger <cg@exept.de>
parents: 6950
diff changeset
  2773
    "Like halt, but disabled by default.
c3408e945eb5 oops - breakpoint lost
Claus Gittinger <cg@exept.de>
parents: 6950
diff changeset
  2774
     Can be easily enabled.
c3408e945eb5 oops - breakpoint lost
Claus Gittinger <cg@exept.de>
parents: 6950
diff changeset
  2775
     Can be filtered on the arguments value (typically: a symbol).
c3408e945eb5 oops - breakpoint lost
Claus Gittinger <cg@exept.de>
parents: 6950
diff changeset
  2776
     Code with breakpoints may be even checked into the source repository"
c3408e945eb5 oops - breakpoint lost
Claus Gittinger <cg@exept.de>
parents: 6950
diff changeset
  2777
c3408e945eb5 oops - breakpoint lost
Claus Gittinger <cg@exept.de>
parents: 6950
diff changeset
  2778
    "Example:   nil breakPoint:#stefan"
c3408e945eb5 oops - breakpoint lost
Claus Gittinger <cg@exept.de>
parents: 6950
diff changeset
  2779
11025
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  2780
    <resource: #skipInDebuggersWalkBack>
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  2781
11048
feed33f1f796 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11045
diff changeset
  2782
    "/ dont send #breakPoint:info: here - ask cg why.
feed33f1f796 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11045
diff changeset
  2783
    (self isBreakPointEnabled:someKey) ifTrue:[
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2784
        ^ HaltSignal
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2785
            raiseRequestWith:someKey
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2786
            errorString:('Breakpoint encountered: %1' bindWith:someKey)
11048
feed33f1f796 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11045
diff changeset
  2787
    ].
11025
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  2788
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  2789
    "
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  2790
     nil breakPoint:#stefan
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  2791
     nil breakPoint:#stefan info:'Hello'
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  2792
     Smalltalk enableBreakPoint:#stefan.
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  2793
     Smalltalk disableBreakPoint:#stefan.
11048
feed33f1f796 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11045
diff changeset
  2794
feed33f1f796 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11045
diff changeset
  2795
     EncounteredBreakPoints.
feed33f1f796 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11045
diff changeset
  2796
     Smalltalk enableBreakPoint:#cg.
feed33f1f796 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11045
diff changeset
  2797
     Smalltalk disableBreakPoint:#cg.
11025
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  2798
    "
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  2799
!
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  2800
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  2801
breakPoint:someKey info:infoString
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  2802
    "{ Pragma: +optSpace }"
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  2803
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  2804
    "Like halt, but disabled by default.
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  2805
     Can be easily enabled.
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  2806
     Can be filtered on the arguments value (typically: a symbol).
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  2807
     Code with breakpoints may be even checked into the source repository"
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  2808
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  2809
    "Example:   nil breakPoint:#stefan"
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  2810
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  2811
    <resource: #skipInDebuggersWalkBack>
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  2812
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  2813
    (self isBreakPointEnabled:someKey) ifTrue:[
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2814
        ^ HaltSignal
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2815
            raiseRequestWith:someKey
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2816
            errorString:(infoString bindWith:someKey)
11025
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  2817
    ].
6954
c3408e945eb5 oops - breakpoint lost
Claus Gittinger <cg@exept.de>
parents: 6950
diff changeset
  2818
!
c3408e945eb5 oops - breakpoint lost
Claus Gittinger <cg@exept.de>
parents: 6950
diff changeset
  2819
5995
21ba36ffaf3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5980
diff changeset
  2820
browse
21ba36ffaf3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5980
diff changeset
  2821
    "open a browser on the receivers class"
21ba36ffaf3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5980
diff changeset
  2822
21ba36ffaf3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5980
diff changeset
  2823
    self class theNonMetaclass browse
21ba36ffaf3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5980
diff changeset
  2824
21ba36ffaf3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5980
diff changeset
  2825
    "
21ba36ffaf3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5980
diff changeset
  2826
     10 browse
21ba36ffaf3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5980
diff changeset
  2827
     Collection browse
21ba36ffaf3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5980
diff changeset
  2828
     Collection class browse
21ba36ffaf3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5980
diff changeset
  2829
    "
21ba36ffaf3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5980
diff changeset
  2830
!
21ba36ffaf3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5980
diff changeset
  2831
11244
7ecd4a866064 debuggingCodeFor:is:
Claus Gittinger <cg@exept.de>
parents: 11236
diff changeset
  2832
debuggingCodeFor:someKey is:aBlock
7ecd4a866064 debuggingCodeFor:is:
Claus Gittinger <cg@exept.de>
parents: 11236
diff changeset
  2833
    "{ Pragma: +optSpace }"
7ecd4a866064 debuggingCodeFor:is:
Claus Gittinger <cg@exept.de>
parents: 11236
diff changeset
  2834
7ecd4a866064 debuggingCodeFor:is:
Claus Gittinger <cg@exept.de>
parents: 11236
diff changeset
  2835
    "aBlock is evaluated if breakPoints for somekey are enabled.
7ecd4a866064 debuggingCodeFor:is:
Claus Gittinger <cg@exept.de>
parents: 11236
diff changeset
  2836
     Allows for debugging code to be enabled/disabled via the breakpoint browser.
7ecd4a866064 debuggingCodeFor:is:
Claus Gittinger <cg@exept.de>
parents: 11236
diff changeset
  2837
     Can be easily enabled.
7ecd4a866064 debuggingCodeFor:is:
Claus Gittinger <cg@exept.de>
parents: 11236
diff changeset
  2838
     Can be filtered on the arguments value (typically: a symbol).
7ecd4a866064 debuggingCodeFor:is:
Claus Gittinger <cg@exept.de>
parents: 11236
diff changeset
  2839
     Code with breakpoints may be even checked into the source repository"
7ecd4a866064 debuggingCodeFor:is:
Claus Gittinger <cg@exept.de>
parents: 11236
diff changeset
  2840
7ecd4a866064 debuggingCodeFor:is:
Claus Gittinger <cg@exept.de>
parents: 11236
diff changeset
  2841
    "Example:   nil debuggingCodeFor:#cg is:[ self halt ]"
7ecd4a866064 debuggingCodeFor:is:
Claus Gittinger <cg@exept.de>
parents: 11236
diff changeset
  2842
7ecd4a866064 debuggingCodeFor:is:
Claus Gittinger <cg@exept.de>
parents: 11236
diff changeset
  2843
    <resource: #skipInDebuggersWalkBack>
7ecd4a866064 debuggingCodeFor:is:
Claus Gittinger <cg@exept.de>
parents: 11236
diff changeset
  2844
7ecd4a866064 debuggingCodeFor:is:
Claus Gittinger <cg@exept.de>
parents: 11236
diff changeset
  2845
    (self isBreakPointEnabled:someKey) ifTrue:[
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2846
        aBlock value
11244
7ecd4a866064 debuggingCodeFor:is:
Claus Gittinger <cg@exept.de>
parents: 11236
diff changeset
  2847
    ].
7ecd4a866064 debuggingCodeFor:is:
Claus Gittinger <cg@exept.de>
parents: 11236
diff changeset
  2848
7ecd4a866064 debuggingCodeFor:is:
Claus Gittinger <cg@exept.de>
parents: 11236
diff changeset
  2849
    "
7ecd4a866064 debuggingCodeFor:is:
Claus Gittinger <cg@exept.de>
parents: 11236
diff changeset
  2850
     Smalltalk disableBreakPoint:#cg.
12340
e9ea989ffe01 comment/format in: #debuggingCodeFor:is:
Claus Gittinger <cg@exept.de>
parents: 12328
diff changeset
  2851
     nil debuggingCodeFor:#cg is:[ Transcript showCR:'here is some debug message for cg' ].
e9ea989ffe01 comment/format in: #debuggingCodeFor:is:
Claus Gittinger <cg@exept.de>
parents: 12328
diff changeset
  2852
     nil debuggingCodeFor:#stefan is:[ Transcript showCR:'here is some debug message for sv' ].
11244
7ecd4a866064 debuggingCodeFor:is:
Claus Gittinger <cg@exept.de>
parents: 11236
diff changeset
  2853
     Smalltalk enableBreakPoint:#cg.
12340
e9ea989ffe01 comment/format in: #debuggingCodeFor:is:
Claus Gittinger <cg@exept.de>
parents: 12328
diff changeset
  2854
     nil debuggingCodeFor:#cg is:[ Transcript showCR:'here is some debug message for cg' ].
e9ea989ffe01 comment/format in: #debuggingCodeFor:is:
Claus Gittinger <cg@exept.de>
parents: 12328
diff changeset
  2855
     nil debuggingCodeFor:#stefan is:[ Transcript showCR:'here is some debug message for sv' ].
11244
7ecd4a866064 debuggingCodeFor:is:
Claus Gittinger <cg@exept.de>
parents: 11236
diff changeset
  2856
     Smalltalk disableBreakPoint:#cg.
7ecd4a866064 debuggingCodeFor:is:
Claus Gittinger <cg@exept.de>
parents: 11236
diff changeset
  2857
7ecd4a866064 debuggingCodeFor:is:
Claus Gittinger <cg@exept.de>
parents: 11236
diff changeset
  2858
    "
7ecd4a866064 debuggingCodeFor:is:
Claus Gittinger <cg@exept.de>
parents: 11236
diff changeset
  2859
!
7ecd4a866064 debuggingCodeFor:is:
Claus Gittinger <cg@exept.de>
parents: 11236
diff changeset
  2860
14046
541f46216cb4 added: #disableAllBreakPoints
Claus Gittinger <cg@exept.de>
parents: 13990
diff changeset
  2861
disableAllBreakPoints
541f46216cb4 added: #disableAllBreakPoints
Claus Gittinger <cg@exept.de>
parents: 13990
diff changeset
  2862
    "disable all parametrized breakPoints (with any key as parameter)"
541f46216cb4 added: #disableAllBreakPoints
Claus Gittinger <cg@exept.de>
parents: 13990
diff changeset
  2863
541f46216cb4 added: #disableAllBreakPoints
Claus Gittinger <cg@exept.de>
parents: 13990
diff changeset
  2864
    EnabledBreakPoints := nil
541f46216cb4 added: #disableAllBreakPoints
Claus Gittinger <cg@exept.de>
parents: 13990
diff changeset
  2865
541f46216cb4 added: #disableAllBreakPoints
Claus Gittinger <cg@exept.de>
parents: 13990
diff changeset
  2866
    "
541f46216cb4 added: #disableAllBreakPoints
Claus Gittinger <cg@exept.de>
parents: 13990
diff changeset
  2867
     nil enableBreakPoint:#cg.
541f46216cb4 added: #disableAllBreakPoints
Claus Gittinger <cg@exept.de>
parents: 13990
diff changeset
  2868
     nil breakPoint:#cg.
541f46216cb4 added: #disableAllBreakPoints
Claus Gittinger <cg@exept.de>
parents: 13990
diff changeset
  2869
     nil disableAllBreakPoints.
541f46216cb4 added: #disableAllBreakPoints
Claus Gittinger <cg@exept.de>
parents: 13990
diff changeset
  2870
     nil breakPoint:#cg.
541f46216cb4 added: #disableAllBreakPoints
Claus Gittinger <cg@exept.de>
parents: 13990
diff changeset
  2871
    "
541f46216cb4 added: #disableAllBreakPoints
Claus Gittinger <cg@exept.de>
parents: 13990
diff changeset
  2872
541f46216cb4 added: #disableAllBreakPoints
Claus Gittinger <cg@exept.de>
parents: 13990
diff changeset
  2873
    "Created: / 06-03-2012 / 15:32:28 / cg"
541f46216cb4 added: #disableAllBreakPoints
Claus Gittinger <cg@exept.de>
parents: 13990
diff changeset
  2874
!
541f46216cb4 added: #disableAllBreakPoints
Claus Gittinger <cg@exept.de>
parents: 13990
diff changeset
  2875
11025
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  2876
disableBreakPoint:someKey
14046
541f46216cb4 added: #disableAllBreakPoints
Claus Gittinger <cg@exept.de>
parents: 13990
diff changeset
  2877
    "disable parametrized breakPoints with someKey as parameter"
11025
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  2878
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  2879
    "{ Pragma: +optSpace }"
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  2880
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  2881
    EnabledBreakPoints notNil ifTrue:[
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2882
        EnabledBreakPoints remove:someKey ifAbsent:[].
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2883
        EnabledBreakPoints isEmpty ifTrue:[
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2884
            EnabledBreakPoints := nil
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2885
        ].
11025
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  2886
    ].
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  2887
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  2888
    "
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  2889
     nil enableBreakPoint:#cg.
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  2890
     nil breakPoint:#cg.
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  2891
     nil disableBreakPoint:#cg
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  2892
     nil breakPoint:#cg.
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  2893
    "
14046
541f46216cb4 added: #disableAllBreakPoints
Claus Gittinger <cg@exept.de>
parents: 13990
diff changeset
  2894
541f46216cb4 added: #disableAllBreakPoints
Claus Gittinger <cg@exept.de>
parents: 13990
diff changeset
  2895
    "Modified (comment): / 06-03-2012 / 15:31:51 / cg"
11025
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  2896
!
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  2897
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  2898
enableBreakPoint:someKey
14046
541f46216cb4 added: #disableAllBreakPoints
Claus Gittinger <cg@exept.de>
parents: 13990
diff changeset
  2899
    "enable parametrized breakPoints with someKey as parameter"
11025
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  2900
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  2901
    "{ Pragma: +optSpace }"
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  2902
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  2903
    EnabledBreakPoints isNil ifTrue:[
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2904
        EnabledBreakPoints := Set new.
11025
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  2905
    ].
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  2906
    EnabledBreakPoints add:someKey.
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  2907
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  2908
    "
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  2909
     nil enableBreakPoint:#cg.
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  2910
     nil breakPoint:#cg.
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  2911
     nil disableBreakPoint:#cg
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  2912
     nil breakPoint:#cg.
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  2913
    "
14046
541f46216cb4 added: #disableAllBreakPoints
Claus Gittinger <cg@exept.de>
parents: 13990
diff changeset
  2914
541f46216cb4 added: #disableAllBreakPoints
Claus Gittinger <cg@exept.de>
parents: 13990
diff changeset
  2915
    "Modified (comment): / 06-03-2012 / 15:31:47 / cg"
11025
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  2916
!
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  2917
11048
feed33f1f796 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11045
diff changeset
  2918
halt
feed33f1f796 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11045
diff changeset
  2919
    "{ Pragma: +optSpace }"
feed33f1f796 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11045
diff changeset
  2920
feed33f1f796 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11045
diff changeset
  2921
    "enter debugger with halt-message.
feed33f1f796 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11045
diff changeset
  2922
     The error is reported by raising the HaltSignal exception."
feed33f1f796 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11045
diff changeset
  2923
feed33f1f796 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11045
diff changeset
  2924
    <resource: #skipInDebuggersWalkBack>
feed33f1f796 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11045
diff changeset
  2925
feed33f1f796 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11045
diff changeset
  2926
    "/ dont send #halt: here - ask cg why.
13136
e7d331537665 changed:
Claus Gittinger <cg@exept.de>
parents: 13099
diff changeset
  2927
    Smalltalk ignoreHalt ifTrue:[^ self].
11048
feed33f1f796 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11045
diff changeset
  2928
    ^ HaltInterrupt raiseRequestWith:#halt
feed33f1f796 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11045
diff changeset
  2929
13136
e7d331537665 changed:
Claus Gittinger <cg@exept.de>
parents: 13099
diff changeset
  2930
    "Modified: / 02-08-1999 / 17:00:29 / stefan"
e7d331537665 changed:
Claus Gittinger <cg@exept.de>
parents: 13099
diff changeset
  2931
    "Modified: / 18-11-2010 / 11:21:51 / cg"
11048
feed33f1f796 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11045
diff changeset
  2932
!
feed33f1f796 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11045
diff changeset
  2933
feed33f1f796 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11045
diff changeset
  2934
halt:aString
feed33f1f796 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11045
diff changeset
  2935
    "{ Pragma: +optSpace }"
feed33f1f796 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11045
diff changeset
  2936
feed33f1f796 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11045
diff changeset
  2937
    "enter debugger with halt-message.
feed33f1f796 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11045
diff changeset
  2938
     The error is reported by raising the HaltSignal exception."
feed33f1f796 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11045
diff changeset
  2939
feed33f1f796 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11045
diff changeset
  2940
    <resource: #skipInDebuggersWalkBack>
feed33f1f796 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11045
diff changeset
  2941
13136
e7d331537665 changed:
Claus Gittinger <cg@exept.de>
parents: 13099
diff changeset
  2942
    Smalltalk ignoreHalt ifTrue:[^ self].
11048
feed33f1f796 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11045
diff changeset
  2943
    ^ HaltInterrupt raiseRequestWith:#halt: errorString:aString
feed33f1f796 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11045
diff changeset
  2944
13136
e7d331537665 changed:
Claus Gittinger <cg@exept.de>
parents: 13099
diff changeset
  2945
    "Modified: / 18-11-2010 / 11:22:16 / cg"
11048
feed33f1f796 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11045
diff changeset
  2946
!
feed33f1f796 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11045
diff changeset
  2947
11025
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  2948
isBreakPointEnabled:someKey
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  2949
    "{ Pragma: +optSpace }"
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  2950
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  2951
    "controls which breakpoints to be enabled."
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  2952
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  2953
"/    something = OperatingSystem getLoginName ifTrue:[^ true].
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  2954
"/    something = 'testThis' ifTrue:[^ true].
11044
fa13d9423e71 allow for encounteredBreakPoints to be monitored
Claus Gittinger <cg@exept.de>
parents: 11025
diff changeset
  2955
    EncounteredBreakPoints notNil ifTrue:[
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2956
        EncounteredBreakPoints add:someKey
11335
c061d08b766f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11314
diff changeset
  2957
    ].
c061d08b766f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11314
diff changeset
  2958
c061d08b766f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11314
diff changeset
  2959
    ^ (EnabledBreakPoints notNil and:[ EnabledBreakPoints includes:someKey ])
11025
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  2960
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  2961
    "
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  2962
     nil enableBreakPoint:#cg.
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  2963
     nil breakPoint:#cg.
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  2964
     nil disableBreakPoint:#cg
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  2965
     nil breakPoint:#cg.
11045
85315d8893e4 allow for encounteredBreakPoints to be monitored
Claus Gittinger <cg@exept.de>
parents: 11044
diff changeset
  2966
85315d8893e4 allow for encounteredBreakPoints to be monitored
Claus Gittinger <cg@exept.de>
parents: 11044
diff changeset
  2967
     EncounteredBreakPoints := Set new.
11025
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  2968
    "
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  2969
!
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  2970
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2971
mustBeBoolean
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2972
    "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
  2973
     in an if* or while* message.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2974
     Caveat: for now, this is only sent by the interpreter;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2975
     both the JIT and the stc compiler treat it as undefined."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2976
11021
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  2977
    <resource: #skipInDebuggersWalkBack>
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  2978
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2979
    self error:'Non boolean receiver - proceed for truth' mayProceed:true.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2980
    ^ true
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
mustBeKindOf:aClass
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  2984
    "for compatibility & debugging support:
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2985
     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
  2986
     Notice:
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2987
        it is VERY questionable, if it makes sense to add manual
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2988
        type checks to a dynamically typed language like smalltalk.
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2989
        It will, at least, slow down performance,
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2990
        make your code less reusable and clutter your code with stupid sends
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2991
        of this selector. Also, read the comment in isKindOf:, regarding the
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2992
        use of isXXX check methods.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2993
     You see: The author does not like this at all ..."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2994
11021
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  2995
    <resource: #skipInDebuggersWalkBack>
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  2996
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2997
    (self isKindOf:aClass) ifFalse:[
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  2998
        self error:'argument is not of expected type'
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2999
    ]
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3000
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3001
6950
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3002
obsoleteFeatureWarning
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3003
    "{ Pragma: +optSpace }"
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3004
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3005
    "in methods which are going to be changed, a send to
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3006
     this method is used to tell programmers that some feature/semantics is
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3007
     used which is going to be changed in later ST/X versions.
6963
711b3bf3b38a comments
Claus Gittinger <cg@exept.de>
parents: 6962
diff changeset
  3008
     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
  3009
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3010
    self obsoleteFeatureWarning:nil from:thisContext sender
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3011
!
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3012
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3013
obsoleteFeatureWarning:message
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3014
    "{ Pragma: +optSpace }"
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3015
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3016
    "in methods which are going to be changed, a send to
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3017
     this method is used to tell programmers that some feature/semantics is
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3018
     used which is going to be changed in later ST/X versions.
6963
711b3bf3b38a comments
Claus Gittinger <cg@exept.de>
parents: 6962
diff changeset
  3019
     Hopefully, this warning message is annoying enough for you to change the code... ;-).
711b3bf3b38a comments
Claus Gittinger <cg@exept.de>
parents: 6962
diff changeset
  3020
     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
  3021
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3022
    self obsoleteFeatureWarning:message from:thisContext sender
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3023
!
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3024
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3025
obsoleteFeatureWarning:message from:aContext
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3026
    "{ Pragma: +optSpace }"
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3027
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3028
    "in methods which are going to be changed, a send to
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3029
     this method is used to tell programmers that some feature/semantics is
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3030
     used which is going to be changed in later ST/X versions.
6963
711b3bf3b38a comments
Claus Gittinger <cg@exept.de>
parents: 6962
diff changeset
  3031
     Hopefully, this warning message is annoying enough for you to change the code... ;-).
711b3bf3b38a comments
Claus Gittinger <cg@exept.de>
parents: 6962
diff changeset
  3032
     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
  3033
11527
d8f1c75ee4d2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11401
diff changeset
  3034
    |spec sender|
6950
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3035
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3036
    spec := aContext methodPrintString.
11527
d8f1c75ee4d2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11401
diff changeset
  3037
    sender := aContext sender.
d8f1c75ee4d2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11401
diff changeset
  3038
6950
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3039
    ('WARNING: the ''' , spec , ''' semantics will be changed.') infoPrintCR.
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3040
    ('         Its behavior may be different in future ST/X versions.') infoPrintCR.
11527
d8f1c75ee4d2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11401
diff changeset
  3041
    ('         called from ' , sender printString) infoPrintCR.
d8f1c75ee4d2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11401
diff changeset
  3042
    ((sender selector ? '') startsWith:'perform:') ifTrue:[
d8f1c75ee4d2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11401
diff changeset
  3043
    ('         called from ' , sender sender printString) infoPrintCR.
7204
e968d9923408 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 7202
diff changeset
  3044
    ].
6950
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3045
    message notNil ifTrue:[
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  3046
        '------>  ' infoPrint. message infoPrintCR
6950
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3047
    ]
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3048
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3049
    "
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3050
     Object obsoleteFeatureWarning:'foo' from:thisContext sender sender
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3051
    "
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3052
!
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3053
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3054
obsoleteMethodWarning
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3055
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3056
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3057
    "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
  3058
     this method is used to tell programmers that a method is
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3059
     used which is going to be removed in later ST/X versions.
6963
711b3bf3b38a comments
Claus Gittinger <cg@exept.de>
parents: 6962
diff changeset
  3060
     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
  3061
     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
  3062
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3063
    self obsoleteMethodWarning:nil from:thisContext sender
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3064
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3065
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3066
obsoleteMethodWarning:message
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3067
    "{ Pragma: +optSpace }"
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
    "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
  3070
     this method is used to tell programmers that a method is
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3071
     used which is going to be removed in later ST/X versions.
6963
711b3bf3b38a comments
Claus Gittinger <cg@exept.de>
parents: 6962
diff changeset
  3072
     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
  3073
     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
  3074
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3075
    self obsoleteMethodWarning:message from:thisContext sender
8829
9e640b6c0679 No obsolete messages in standalone apps
Stefan Vogel <sv@exept.de>
parents: 8827
diff changeset
  3076
!
9e640b6c0679 No obsolete messages in standalone apps
Stefan Vogel <sv@exept.de>
parents: 8827
diff changeset
  3077
9e640b6c0679 No obsolete messages in standalone apps
Stefan Vogel <sv@exept.de>
parents: 8827
diff changeset
  3078
obsoleteMethodWarning:message from:aContext
9e640b6c0679 No obsolete messages in standalone apps
Stefan Vogel <sv@exept.de>
parents: 8827
diff changeset
  3079
    "{ Pragma: +optSpace }"
9e640b6c0679 No obsolete messages in standalone apps
Stefan Vogel <sv@exept.de>
parents: 8827
diff changeset
  3080
9e640b6c0679 No obsolete messages in standalone apps
Stefan Vogel <sv@exept.de>
parents: 8827
diff changeset
  3081
    "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
  3082
     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
  3083
     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
  3084
     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
  3085
     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
  3086
     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
  3087
9e640b6c0679 No obsolete messages in standalone apps
Stefan Vogel <sv@exept.de>
parents: 8827
diff changeset
  3088
    |spec sender|
9e640b6c0679 No obsolete messages in standalone apps
Stefan Vogel <sv@exept.de>
parents: 8827
diff changeset
  3089
9509
bfb55a08130d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9442
diff changeset
  3090
    Smalltalk isSmalltalkDevelopmentSystem ifFalse:[
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  3091
        "ignore in production systems"
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  3092
        ^ self.
8829
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
9e640b6c0679 No obsolete messages in standalone apps
Stefan Vogel <sv@exept.de>
parents: 8827
diff changeset
  3095
    spec := aContext methodPrintString.
9e640b6c0679 No obsolete messages in standalone apps
Stefan Vogel <sv@exept.de>
parents: 8827
diff changeset
  3096
    sender := aContext sender.
9e640b6c0679 No obsolete messages in standalone apps
Stefan Vogel <sv@exept.de>
parents: 8827
diff changeset
  3097
    ('WARNING: the ''' , spec , ''' method is obsolete.') infoPrintCR.
9e640b6c0679 No obsolete messages in standalone apps
Stefan Vogel <sv@exept.de>
parents: 8827
diff changeset
  3098
    ('         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
  3099
    ('         called from ' , sender printString) infoPrintCR.
9e640b6c0679 No obsolete messages in standalone apps
Stefan Vogel <sv@exept.de>
parents: 8827
diff changeset
  3100
    (sender selector startsWith:'perform:') ifTrue:[
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  3101
        sender := sender sender.
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  3102
        (sender selector startsWith:'perform:') ifTrue:[
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  3103
            sender := sender sender.
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  3104
        ].
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  3105
        ('         called from ' , sender printString) infoPrintCR.
8829
9e640b6c0679 No obsolete messages in standalone apps
Stefan Vogel <sv@exept.de>
parents: 8827
diff changeset
  3106
    ].
9e640b6c0679 No obsolete messages in standalone apps
Stefan Vogel <sv@exept.de>
parents: 8827
diff changeset
  3107
    message notNil ifTrue:[
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  3108
        '------>  ' infoPrint. message infoPrintCR
8829
9e640b6c0679 No obsolete messages in standalone apps
Stefan Vogel <sv@exept.de>
parents: 8827
diff changeset
  3109
    ]
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
    "
9e640b6c0679 No obsolete messages in standalone apps
Stefan Vogel <sv@exept.de>
parents: 8827
diff changeset
  3112
     Object obsoleteMethodWarning:'foo' from:thisContext sender sender
9e640b6c0679 No obsolete messages in standalone apps
Stefan Vogel <sv@exept.de>
parents: 8827
diff changeset
  3113
    "
9509
bfb55a08130d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9442
diff changeset
  3114
bfb55a08130d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9442
diff changeset
  3115
    "Modified: / 10-08-2006 / 13:13:11 / cg"
10558
Claus Gittinger <cg@exept.de>
parents: 10539
diff changeset
  3116
!
Claus Gittinger <cg@exept.de>
parents: 10539
diff changeset
  3117
12341
47a2bade1cbd added: #todo
Claus Gittinger <cg@exept.de>
parents: 12340
diff changeset
  3118
todo
47a2bade1cbd added: #todo
Claus Gittinger <cg@exept.de>
parents: 12340
diff changeset
  3119
    "used to mark code pieces that have to be implemented"
47a2bade1cbd added: #todo
Claus Gittinger <cg@exept.de>
parents: 12340
diff changeset
  3120
47a2bade1cbd added: #todo
Claus Gittinger <cg@exept.de>
parents: 12340
diff changeset
  3121
    <resource: #skipInDebuggersWalkBack>
47a2bade1cbd added: #todo
Claus Gittinger <cg@exept.de>
parents: 12340
diff changeset
  3122
47a2bade1cbd added: #todo
Claus Gittinger <cg@exept.de>
parents: 12340
diff changeset
  3123
    self halt:'more work needed here'.
47a2bade1cbd added: #todo
Claus Gittinger <cg@exept.de>
parents: 12340
diff changeset
  3124
47a2bade1cbd added: #todo
Claus Gittinger <cg@exept.de>
parents: 12340
diff changeset
  3125
    "
47a2bade1cbd added: #todo
Claus Gittinger <cg@exept.de>
parents: 12340
diff changeset
  3126
     example:
47a2bade1cbd added: #todo
Claus Gittinger <cg@exept.de>
parents: 12340
diff changeset
  3127
13812
Stefan Vogel <sv@exept.de>
parents: 13800
diff changeset
  3128
        ...
Stefan Vogel <sv@exept.de>
parents: 13800
diff changeset
  3129
        self todo.
Stefan Vogel <sv@exept.de>
parents: 13800
diff changeset
  3130
        ...
12341
47a2bade1cbd added: #todo
Claus Gittinger <cg@exept.de>
parents: 12340
diff changeset
  3131
    "
47a2bade1cbd added: #todo
Claus Gittinger <cg@exept.de>
parents: 12340
diff changeset
  3132
!
47a2bade1cbd added: #todo
Claus Gittinger <cg@exept.de>
parents: 12340
diff changeset
  3133
10558
Claus Gittinger <cg@exept.de>
parents: 10539
diff changeset
  3134
todo:aBlock
Claus Gittinger <cg@exept.de>
parents: 10539
diff changeset
  3135
    "used to mark code pieces that have to be implemented"
Claus Gittinger <cg@exept.de>
parents: 10539
diff changeset
  3136
12341
47a2bade1cbd added: #todo
Claus Gittinger <cg@exept.de>
parents: 12340
diff changeset
  3137
    <resource: #skipInDebuggersWalkBack>
47a2bade1cbd added: #todo
Claus Gittinger <cg@exept.de>
parents: 12340
diff changeset
  3138
10558
Claus Gittinger <cg@exept.de>
parents: 10539
diff changeset
  3139
"/    self halt.
Claus Gittinger <cg@exept.de>
parents: 10539
diff changeset
  3140
"/    aBlock value.
Claus Gittinger <cg@exept.de>
parents: 10539
diff changeset
  3141
Claus Gittinger <cg@exept.de>
parents: 10539
diff changeset
  3142
    "
Claus Gittinger <cg@exept.de>
parents: 10539
diff changeset
  3143
     example:
Claus Gittinger <cg@exept.de>
parents: 10539
diff changeset
  3144
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  3145
        ...
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  3146
        self todo:[
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  3147
            code which needs more work ...
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  3148
        ].
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  3149
        ...
10558
Claus Gittinger <cg@exept.de>
parents: 10539
diff changeset
  3150
    "
Claus Gittinger <cg@exept.de>
parents: 10539
diff changeset
  3151
Claus Gittinger <cg@exept.de>
parents: 10539
diff changeset
  3152
    "Created: / 25-05-2007 / 21:34:39 / cg"
Claus Gittinger <cg@exept.de>
parents: 10539
diff changeset
  3153
    "Modified: / 29-05-2007 / 12:11:33 / cg"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3154
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3155
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3156
!Object methodsFor:'dependents access'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3157
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3158
addDependent:anObject
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3159
    "make the argument, anObject be a dependent of the receiver"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3160
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3161
    |wasBlocked|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3162
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3163
    "/ must do this save from interrupts, since the dependents collection
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3164
    "/ is possibly accessed from multiple threads.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3165
    "/ Used to use #valueUninterruptably here; inlined that code for slightly
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3166
    "/ faster execution.
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
    wasBlocked := OperatingSystem blockInterrupts.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3169
    [
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  3170
        |deps dep|
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  3171
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  3172
        deps := self dependents.
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  3173
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  3174
        "/ to save a fair amount of memory in case of
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  3175
        "/ many dependencies, we store a single dependent in
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  3176
        "/ a WeakArray, and switch to a WeakSet if more dependents are
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  3177
        "/ added.
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  3178
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  3179
        (deps isNil or:[deps size == 0]) ifTrue:[
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  3180
            self dependents:(WeakArray with:anObject)
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  3181
        ] ifFalse:[
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  3182
            deps class == WeakArray ifTrue:[
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  3183
                dep := deps at:1.
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  3184
                dep ~~ anObject ifTrue:[
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  3185
                    (dep isNil or:[dep == 0]) ifTrue:[
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  3186
                        deps at:1 put:anObject
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  3187
                    ] ifFalse:[
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  3188
                        self dependents:(WeakIdentitySet with:dep with:anObject)
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  3189
                    ]
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  3190
                ]
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  3191
            ] ifFalse:[
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  3192
                deps add:anObject
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  3193
            ]
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  3194
        ]
6421
58dca33cf0fc #valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents: 6418
diff changeset
  3195
    ] ensure:[
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  3196
        wasBlocked ifFalse:[
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  3197
            OperatingSystem unblockInterrupts
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  3198
        ]
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3199
    ]
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3200
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3201
    "Modified: / 27.10.1997 / 19:35:52 / cg"
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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3204
breakDependents
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3205
    "remove all dependencies from the receiver"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3206
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3207
    self dependents:nil.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3208
    self nonWeakDependents:nil
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: / 19.4.1996 / 10:55:36 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3211
    "Created: / 27.2.1998 / 11:26:11 / stefan"
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
8542
38f9d04fe40a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8521
diff changeset
  3214
breakDependentsRecursively
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  3215
    "remove all dependencies from the receiver and
8542
38f9d04fe40a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8521
diff changeset
  3216
     recursively from all objects referred to by the receiver."
38f9d04fe40a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8521
diff changeset
  3217
38f9d04fe40a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8521
diff changeset
  3218
    self breakDependents.
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  3219
    1 to:self class instSize do:[:idx |
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  3220
        (self instVarAt:idx) breakDependentsRecursively.
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  3221
    ].
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  3222
    1 to:self basicSize do:[:idx |
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  3223
        (self basicAt:idx) breakDependentsRecursively.
8542
38f9d04fe40a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8521
diff changeset
  3224
    ]
38f9d04fe40a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8521
diff changeset
  3225
!
38f9d04fe40a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8521
diff changeset
  3226
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3227
dependents
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3228
    "return a Collection of dependents.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3229
     The default implementation here uses a global WeakDictionary to store
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  3230
     dependents
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3231
     This may be too slow for high frequency change&update,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3232
     therefore, some classes (Model) redefine this for better performance.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3233
     Notice the mentioning of a WeakDictionary - read the classes documentation."
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
    |deps|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3236
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3237
    (deps := Dependencies at:self ifAbsent:nil) isNil ifTrue:[
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  3238
        ^ #().
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3239
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3240
    ^ deps
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3241
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3242
    "Modified: / 26.1.1998 / 11:18:15 / cg"
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
dependents:aCollection
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3246
    "set the collection of dependents.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3247
     The default implementation here uses a global Dictionary to store
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3248
     dependents which may be too slow for high frequency change&update.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3249
     Therefore, some classes (Model) redefine this for better performance."
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
    "/ must do this save from interrupts, since the dependents collection
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3252
    "/ is possibly accessed from multiple threads.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3253
    "/ Used to use #valueUninterruptably here; inlined that code for slightly
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3254
    "/ faster execution (and to avoid creation of garbage blocks).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3255
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3256
    (OperatingSystem blockInterrupts) ifTrue:[
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  3257
        "/ the common case - already blocked
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  3258
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  3259
        (aCollection isNil or:[aCollection isEmpty]) ifTrue:[
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  3260
            Dependencies removeKey:self ifAbsent:nil
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  3261
        ] ifFalse:[
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  3262
            Dependencies at:self put:aCollection
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  3263
        ].
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  3264
        ^ self
5755
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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3267
    [
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  3268
        (aCollection isNil or:[aCollection isEmpty]) ifTrue:[
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  3269
            Dependencies removeKey:self ifAbsent:nil
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  3270
        ] ifFalse:[
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  3271
            Dependencies at:self put:aCollection
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  3272
        ].
6421
58dca33cf0fc #valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents: 6418
diff changeset
  3273
    ] ensure:[
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  3274
        OperatingSystem unblockInterrupts
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3275
    ]
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3276
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3277
    "Modified: 30.1.1997 / 21:22:10 / cg"
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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3280
dependentsDo:aBlock
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3281
    "evaluate aBlock for all of my dependents"
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
    |deps nwDeps|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3284
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3285
    deps := self dependents.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3286
    deps size ~~ 0 ifTrue:[
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  3287
        deps do:[:d |
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  3288
                    (d notNil and:[d ~~ 0]) ifTrue:[
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  3289
                        aBlock value:d
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  3290
                    ]
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  3291
                ]
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3292
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3293
    nwDeps := self nonWeakDependents.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3294
    (nwDeps ~~ deps and:[nwDeps size ~~ 0]) ifTrue:[
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  3295
        nwDeps do:aBlock
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3296
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3297
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3298
    "Modified: / 30.1.1998 / 14:03:40 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3299
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3300
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3301
myDependents
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3302
    "same as dependents - ST-80 compatibility"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3303
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3304
    ^ self dependents
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3305
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3306
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3307
release
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3308
    "remove all references to objects that may refer to self.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3309
     Subclasses may redefine this method but should do a 'super release'."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3310
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3311
    self breakDependents
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3312
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3313
    "Modified: / 27.2.1998 / 11:29:35 / stefan"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3314
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3315
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3316
removeDependent:anObject
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3317
    "make the argument, anObject be independent of the receiver"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3318
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3319
    |wasBlocked|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3320
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3321
    "/ must do this save from interrupts, since the dependents collection
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3322
    "/ is possibly accessed from multiple threads.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3323
    "/ Used to use #valueUninterruptably here; inlined that code for slightly
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3324
    "/ faster execution.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3325
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3326
    wasBlocked := OperatingSystem blockInterrupts.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3327
    [
13500
51b2e6c6c2ac changed:
Claus Gittinger <cg@exept.de>
parents: 13488
diff changeset
  3328
        |deps n d|
51b2e6c6c2ac changed:
Claus Gittinger <cg@exept.de>
parents: 13488
diff changeset
  3329
51b2e6c6c2ac changed:
Claus Gittinger <cg@exept.de>
parents: 13488
diff changeset
  3330
        deps := self dependents.
51b2e6c6c2ac changed:
Claus Gittinger <cg@exept.de>
parents: 13488
diff changeset
  3331
        deps size ~~ 0 ifTrue:[
51b2e6c6c2ac changed:
Claus Gittinger <cg@exept.de>
parents: 13488
diff changeset
  3332
51b2e6c6c2ac changed:
Claus Gittinger <cg@exept.de>
parents: 13488
diff changeset
  3333
            "/ to save a fair amount of memory in case of
51b2e6c6c2ac changed:
Claus Gittinger <cg@exept.de>
parents: 13488
diff changeset
  3334
            "/ many dependencies, we store a single dependent in
51b2e6c6c2ac changed:
Claus Gittinger <cg@exept.de>
parents: 13488
diff changeset
  3335
            "/ a WeakArray, and switch to a WeakSet if more dependents are
51b2e6c6c2ac changed:
Claus Gittinger <cg@exept.de>
parents: 13488
diff changeset
  3336
            "/ added. Here we have to do the inverse ...
51b2e6c6c2ac changed:
Claus Gittinger <cg@exept.de>
parents: 13488
diff changeset
  3337
51b2e6c6c2ac changed:
Claus Gittinger <cg@exept.de>
parents: 13488
diff changeset
  3338
            ((deps class == WeakArray) or:[deps class == Array]) ifTrue:[
51b2e6c6c2ac changed:
Claus Gittinger <cg@exept.de>
parents: 13488
diff changeset
  3339
                ((d := deps at:1) == anObject
51b2e6c6c2ac changed:
Claus Gittinger <cg@exept.de>
parents: 13488
diff changeset
  3340
                or:[d isNil
51b2e6c6c2ac changed:
Claus Gittinger <cg@exept.de>
parents: 13488
diff changeset
  3341
                or:[d == 0]]) ifTrue:[
51b2e6c6c2ac changed:
Claus Gittinger <cg@exept.de>
parents: 13488
diff changeset
  3342
                    self dependents:nil
51b2e6c6c2ac changed:
Claus Gittinger <cg@exept.de>
parents: 13488
diff changeset
  3343
                ]
51b2e6c6c2ac changed:
Claus Gittinger <cg@exept.de>
parents: 13488
diff changeset
  3344
            ] ifFalse:[
51b2e6c6c2ac changed:
Claus Gittinger <cg@exept.de>
parents: 13488
diff changeset
  3345
                deps remove:anObject ifAbsent:[].
51b2e6c6c2ac changed:
Claus Gittinger <cg@exept.de>
parents: 13488
diff changeset
  3346
                (n := deps size) == 0 ifTrue:[
51b2e6c6c2ac changed:
Claus Gittinger <cg@exept.de>
parents: 13488
diff changeset
  3347
                    self dependents:nil
51b2e6c6c2ac changed:
Claus Gittinger <cg@exept.de>
parents: 13488
diff changeset
  3348
                ] ifFalse:[
51b2e6c6c2ac changed:
Claus Gittinger <cg@exept.de>
parents: 13488
diff changeset
  3349
                    n == 1 ifTrue:[
51b2e6c6c2ac changed:
Claus Gittinger <cg@exept.de>
parents: 13488
diff changeset
  3350
                        d := deps firstIfEmpty:nil.
51b2e6c6c2ac changed:
Claus Gittinger <cg@exept.de>
parents: 13488
diff changeset
  3351
                        d notNil ifTrue:[
51b2e6c6c2ac changed:
Claus Gittinger <cg@exept.de>
parents: 13488
diff changeset
  3352
                            deps := (deps isWeakCollection ifTrue:[WeakArray] ifFalse:[Array]) with:d
51b2e6c6c2ac changed:
Claus Gittinger <cg@exept.de>
parents: 13488
diff changeset
  3353
                        ] ifFalse:[
51b2e6c6c2ac changed:
Claus Gittinger <cg@exept.de>
parents: 13488
diff changeset
  3354
                            deps := nil
51b2e6c6c2ac changed:
Claus Gittinger <cg@exept.de>
parents: 13488
diff changeset
  3355
                        ].
51b2e6c6c2ac changed:
Claus Gittinger <cg@exept.de>
parents: 13488
diff changeset
  3356
                        self dependents:deps.
51b2e6c6c2ac changed:
Claus Gittinger <cg@exept.de>
parents: 13488
diff changeset
  3357
                    ]
51b2e6c6c2ac changed:
Claus Gittinger <cg@exept.de>
parents: 13488
diff changeset
  3358
                ]
51b2e6c6c2ac changed:
Claus Gittinger <cg@exept.de>
parents: 13488
diff changeset
  3359
            ]
51b2e6c6c2ac changed:
Claus Gittinger <cg@exept.de>
parents: 13488
diff changeset
  3360
        ]
6421
58dca33cf0fc #valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents: 6418
diff changeset
  3361
    ] ensure:[
13500
51b2e6c6c2ac changed:
Claus Gittinger <cg@exept.de>
parents: 13488
diff changeset
  3362
        wasBlocked ifFalse:[
51b2e6c6c2ac changed:
Claus Gittinger <cg@exept.de>
parents: 13488
diff changeset
  3363
            OperatingSystem unblockInterrupts
51b2e6c6c2ac changed:
Claus Gittinger <cg@exept.de>
parents: 13488
diff changeset
  3364
        ]
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3365
    ]
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3366
13500
51b2e6c6c2ac changed:
Claus Gittinger <cg@exept.de>
parents: 13488
diff changeset
  3367
    "Modified: / 05-07-2011 / 22:49:31 / cg"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3368
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3369
7266
f2b64d3b43cf method category rename
Claus Gittinger <cg@exept.de>
parents: 7261
diff changeset
  3370
!Object methodsFor:'dependents access (non weak)'!
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3371
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3372
addNonWeakDependent:anObject
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3373
    "make the argument, anObject be a nonWeak dependent of the receiver.
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  3374
     Be careful: this nonWeakDependency will prevent the dependent from being
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3375
     garbage collected unless the dependency is removed.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3376
     This is a private mechanism, for directed dependencies."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3377
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3378
    |wasBlocked|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3379
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3380
    "/ must do this save from interrupts, since the dependents collection
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3381
    "/ is possibly accessed from multiple threads.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3382
    "/ Used to use #valueUninterruptably here; inlined that code for slightly
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3383
    "/ faster execution.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3384
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3385
    wasBlocked := OperatingSystem blockInterrupts.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3386
    [
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  3387
        |deps dep|
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  3388
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  3389
        deps := self nonWeakDependents.
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  3390
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  3391
        "/ to save a fair amount of memory in case of
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  3392
        "/ many dependencies, we store a single dependent in
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  3393
        "/ an Array, and switch to a Set if more dependents are
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  3394
        "/ added.
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  3395
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  3396
        deps size == 0 ifTrue:[
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  3397
            anObject notNil ifTrue:[
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  3398
                self nonWeakDependents:(Array with:anObject).
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  3399
            ] ifFalse:[
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  3400
                "adding nil causes problems when adding the next one
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  3401
                 (see below: trying to add nil to IdentitySet)"
9442
f564054eaf6a do not add nil as dependent
Stefan Vogel <sv@exept.de>
parents: 9405
diff changeset
  3402
"/                self halt:'try to add nil to list of dependents'.
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  3403
            ].
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  3404
        ] ifFalse:[
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  3405
            deps class == Array ifTrue:[
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  3406
                dep := deps at:1.
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  3407
                dep ~~ anObject ifTrue:[
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  3408
                    self nonWeakDependents:(IdentitySet with:dep with:anObject)
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  3409
                ]
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  3410
            ] ifFalse:[
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  3411
                deps add:anObject
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  3412
            ]
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  3413
        ]
6421
58dca33cf0fc #valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents: 6418
diff changeset
  3414
    ] ensure:[
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  3415
        wasBlocked ifFalse:[
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  3416
            OperatingSystem unblockInterrupts
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  3417
        ]
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3418
    ]
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3419
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3420
    "Created: / 19.4.1996 / 10:54:08 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3421
    "Modified: / 30.1.1998 / 14:03:08 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3422
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3423
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3424
nonWeakDependents
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3425
    "return a Collection of nonWeakDependents - empty if there is none.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3426
     This is a private mechanism for directed dependencies."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3427
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3428
    NonWeakDependencies isNil ifTrue:[^ #()].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3429
    ^ NonWeakDependencies at:self ifAbsent:#()
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3430
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3431
    "Created: / 19.4.1996 / 10:55:06 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3432
    "Modified: / 30.1.1998 / 14:06:47 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3433
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3434
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3435
nonWeakDependents:aCollection
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3436
    "set the collection of nonWeak dependents.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3437
     This is a private helper for directed dependencies."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3438
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3439
    [
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  3440
        (aCollection isNil or:[aCollection isEmpty]) ifTrue:[
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  3441
            NonWeakDependencies removeKey:self ifAbsent:nil
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  3442
        ] ifFalse:[
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  3443
            NonWeakDependencies at:self put:aCollection
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  3444
        ]
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3445
    ] valueUninterruptably
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3446
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3447
    "Created: 19.4.1996 / 11:07:47 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3448
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3449
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3450
removeNonWeakDependent:anObject
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3451
    "remove a nonWeak dependency from the receiver to the argument, anObject.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3452
     (i.e. make it independent of the receiver)"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3453
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3454
    |wasBlocked|
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
    "/ must do this save from interrupts, since the dependents collection
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3457
    "/ is possibly accessed from multiple threads.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3458
    "/ Used to use #valueUninterruptably here; inlined that code for slightly
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3459
    "/ faster execution.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3460
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3461
    wasBlocked := OperatingSystem blockInterrupts.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3462
    [
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  3463
        |deps n|
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  3464
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  3465
        deps := self nonWeakDependents.
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  3466
        deps size ~~ 0 ifTrue:[
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  3467
            deps class == Array ifTrue:[
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  3468
                (deps at:1) == anObject ifTrue:[
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  3469
                    self nonWeakDependents:nil
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  3470
                ]
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  3471
            ] ifFalse:[
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  3472
                deps remove:anObject ifAbsent:[].
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  3473
                (n := deps size) == 0 ifTrue:[
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  3474
                    self nonWeakDependents:nil
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  3475
                ] ifFalse:[
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  3476
                    n == 1 ifTrue:[
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  3477
                        self nonWeakDependents:(Array with:(deps first))
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  3478
                    ]
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  3479
                ]
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  3480
            ]
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  3481
        ]
6421
58dca33cf0fc #valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents: 6418
diff changeset
  3482
    ] ensure:[
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  3483
        wasBlocked ifFalse:[
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  3484
            OperatingSystem unblockInterrupts
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  3485
        ]
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3486
    ]
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3487
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3488
    "Created: / 19.4.1996 / 11:44:44 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3489
    "Modified: / 30.1.1998 / 14:04:01 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3490
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3491
9279
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3492
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3493
!Object methodsFor:'dependents-st/v event simulation'!
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3494
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3495
removeActionsForEvent:eventName
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3496
    "remove ST/V-style event triggers."
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3497
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3498
    self retractInterestsIn:eventName
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3499
!
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
removeAllActionsWithReceiver:anObject
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3502
    "remove ST/V-style event triggers."
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3503
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3504
    self retractInterestsFor:anObject
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3505
!
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3506
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3507
triggerEvent:eventSymbol withArguments:parameters
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3508
    "perform ST/V-style event triggering."
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3509
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3510
    self changed:eventSymbol with:parameters.
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3511
! !
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3512
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3513
!Object methodsFor:'displaying'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3514
7081
4e1ae4a0b3c1 added ascentOn: (display-ascent);
Claus Gittinger <cg@exept.de>
parents: 7048
diff changeset
  3515
ascentOn:aGC
4e1ae4a0b3c1 added ascentOn: (display-ascent);
Claus Gittinger <cg@exept.de>
parents: 7048
diff changeset
  3516
    "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
  3517
     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
  3518
     coordinate is given by y.
4e1ae4a0b3c1 added ascentOn: (display-ascent);
Claus Gittinger <cg@exept.de>
parents: 7048
diff changeset
  3519
     In other words: some draw above the given y coordinate.
4e1ae4a0b3c1 added ascentOn: (display-ascent);
Claus Gittinger <cg@exept.de>
parents: 7048
diff changeset
  3520
     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
  3521
     the given y coordinate."
4e1ae4a0b3c1 added ascentOn: (display-ascent);
Claus Gittinger <cg@exept.de>
parents: 7048
diff changeset
  3522
11065
17c01b01000f Simplify (and speed up) #ascentOn:
Stefan Vogel <sv@exept.de>
parents: 11048
diff changeset
  3523
    ^ aGC fontAscent
7081
4e1ae4a0b3c1 added ascentOn: (display-ascent);
Claus Gittinger <cg@exept.de>
parents: 7048
diff changeset
  3524
!
4e1ae4a0b3c1 added ascentOn: (display-ascent);
Claus Gittinger <cg@exept.de>
parents: 7048
diff changeset
  3525
6900
3b1eafe032b2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6884
diff changeset
  3526
displayOn:aGCOrStream
7081
4e1ae4a0b3c1 added ascentOn: (display-ascent);
Claus Gittinger <cg@exept.de>
parents: 7048
diff changeset
  3527
    "Compatibility
4e1ae4a0b3c1 added ascentOn: (display-ascent);
Claus Gittinger <cg@exept.de>
parents: 7048
diff changeset
  3528
     append a printed desription on some stream (Dolphin,  Squeak)
4e1ae4a0b3c1 added ascentOn: (display-ascent);
Claus Gittinger <cg@exept.de>
parents: 7048
diff changeset
  3529
     OR:
4e1ae4a0b3c1 added ascentOn: (display-ascent);
Claus Gittinger <cg@exept.de>
parents: 7048
diff changeset
  3530
     display the receiver in a graphicsContext at 0@0 (ST80).
4e1ae4a0b3c1 added ascentOn: (display-ascent);
Claus Gittinger <cg@exept.de>
parents: 7048
diff changeset
  3531
     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
  3532
     (although the fallBack is to display its printString ...)"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3533
7081
4e1ae4a0b3c1 added ascentOn: (display-ascent);
Claus Gittinger <cg@exept.de>
parents: 7048
diff changeset
  3534
    "/ what a kludge - Dolphin and Squeak mean: printOn: a stream;
4e1ae4a0b3c1 added ascentOn: (display-ascent);
Claus Gittinger <cg@exept.de>
parents: 7048
diff changeset
  3535
    "/ ST/X (and some old ST80's) mean: draw-yourself on a GC.
14292
1cbc2d35aa17 Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents: 14272
diff changeset
  3536
    aGCOrStream isStream ifTrue:[
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  3537
        self printOn:aGCOrStream.
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  3538
        ^ self
6900
3b1eafe032b2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6884
diff changeset
  3539
    ].
3b1eafe032b2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6884
diff changeset
  3540
    ^ self displayOn:aGCOrStream x:0 y:0.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3541
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3542
    "Created: 29.5.1996 / 16:28:58 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3543
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3544
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3545
displayOn:aGC at:aPoint
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3546
    "ST-80 Compatibility
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3547
     display the receiver in a graphicsContext - this method allows
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3548
     for any object to be displayed in a ListView - for example."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3549
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3550
    ^ self displayOn:aGC x:(aPoint x) y:(aPoint y).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3551
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3552
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3553
displayOn:aGC x:x y:y
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3554
    "display the receiver in a graphicsContext - this method allows
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3555
     for any object to be displayed in a ListView - for example."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3556
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3557
    self displayOn:aGC x:x y:y opaque:false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3558
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3559
    "Modified: 29.5.1996 / 16:29:38 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3560
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3561
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3562
displayOn:aGc x:x y:y opaque:opaque
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3563
    "display the receiver in a graphicsContext - this method allows
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3564
     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
  3565
     The fallBack here shows the receivers displayString.
733294e1a8cc correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 7211
diff changeset
  3566
     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
  3567
     ask using #ascentOn: if required"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3568
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3569
    |s yBaseline|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3570
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3571
    s := self displayString.
7215
733294e1a8cc correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 7211
diff changeset
  3572
    yBaseline := y "+ aGc font ascent".
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3573
    opaque ifTrue:[
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  3574
        aGc displayOpaqueString:s x:x y:yBaseline.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3575
    ] ifFalse:[
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  3576
        aGc displayString:s x:x y:yBaseline.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3577
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3578
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3579
    "Modified: 29.5.1996 / 16:29:38 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3580
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3581
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3582
displayOpaqueOn:aGC x:x y:y
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3583
    "display the receiver in a graphicsContext - this method allows
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3584
     for any object to be displayed in a ListView - for example."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3585
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3586
    self displayOn:aGC x:x y:y opaque:true
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3587
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3588
    "Modified: / 29.5.1996 / 16:29:38 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3589
    "Created: / 26.10.1997 / 15:01:36 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3590
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3591
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3592
displayString
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3593
    "return a string used when displaying the receiver in a view;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3594
     for example an Inspector. This is usually the same as printString,
14292
1cbc2d35aa17 Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents: 14272
diff changeset
  3595
     but sometimes redefined for a better look.
1cbc2d35aa17 Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents: 14272
diff changeset
  3596
1cbc2d35aa17 Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents: 14272
diff changeset
  3597
     Note: the base method (used by the inspector) is #displayOn:.
1cbc2d35aa17 Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents: 14272
diff changeset
  3598
           So you should implement #displayOn: instead of #displayString in subclasses."
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3599
7081
4e1ae4a0b3c1 added ascentOn: (display-ascent);
Claus Gittinger <cg@exept.de>
parents: 7048
diff changeset
  3600
    |s|
4e1ae4a0b3c1 added ascentOn: (display-ascent);
Claus Gittinger <cg@exept.de>
parents: 7048
diff changeset
  3601
8322
95ca965f65ed Handle unicode in #displayString
Stefan Vogel <sv@exept.de>
parents: 8300
diff changeset
  3602
    s := CharacterWriteStream on:(String new:32).
7081
4e1ae4a0b3c1 added ascentOn: (display-ascent);
Claus Gittinger <cg@exept.de>
parents: 7048
diff changeset
  3603
    self displayOn:s.
4e1ae4a0b3c1 added ascentOn: (display-ascent);
Claus Gittinger <cg@exept.de>
parents: 7048
diff changeset
  3604
    ^ s contents
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3605
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3606
    "
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  3607
     #(1 2 3) printString
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  3608
     #(1 2 3) displayString
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3609
     #(1 2 3) storeString
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3610
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3611
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3612
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3613
heightOn:aGC
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3614
    "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
  3615
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3616
    ^ (aGC font onDevice:aGC device) heightOf:(self displayString)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3617
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3618
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  3619
widthFrom:startIndex to:endIndex on:aGC
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  3620
    "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
  3621
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  3622
    ^ (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
  3623
!
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  3624
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3625
widthOn:aGC
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3626
    "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
  3627
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3628
    ^ (aGC font onDevice:aGC device) widthOf:(self displayString)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3629
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3630
7359
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3631
!Object methodsFor:'double dispatching'!
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3632
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3633
equalFromComplex:aComplex
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3634
    "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
  3635
     and return false from this comparison.
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3636
     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
  3637
     which uses #= (i.e. a Set or Dictionary)."
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3638
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3639
    ^ false
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3640
!
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3641
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3642
equalFromFixedPoint:aFixedPoint
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3643
    "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
  3644
     and return false from this comparison.
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3645
     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
  3646
     which uses #= (i.e. a Set or Dictionary)."
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3647
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3648
    ^ false
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3649
!
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3650
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3651
equalFromFloat:aFloat
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3652
    "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
  3653
     and return false from this comparison.
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3654
     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
  3655
     which uses #= (i.e. a Set or Dictionary)."
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3656
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3657
    ^ false
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3658
!
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3659
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3660
equalFromFraction:aFraction
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3661
    "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
  3662
     and return false from this comparison.
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3663
     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
  3664
     which uses #= (i.e. a Set or Dictionary)."
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3665
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3666
    ^ false
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3667
!
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3668
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3669
equalFromInteger:anInteger
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3670
    "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
  3671
     and return false from this comparison.
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3672
     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
  3673
     which uses #= (i.e. a Set or Dictionary)."
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3674
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3675
    ^ false
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3676
!
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3677
7455
6abc135763f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7402
diff changeset
  3678
equalFromLargeFloat:aLargeFloat
6abc135763f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7402
diff changeset
  3679
    "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
  3680
     and return false from this comparison.
6abc135763f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7402
diff changeset
  3681
     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
  3682
     which uses #= (i.e. a Set or Dictionary)."
6abc135763f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7402
diff changeset
  3683
6abc135763f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7402
diff changeset
  3684
    ^ false
6abc135763f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7402
diff changeset
  3685
!
6abc135763f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7402
diff changeset
  3686
7359
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3687
equalFromLongFloat:aLongFloat
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3688
    "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
  3689
     and return false from this comparison.
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3690
     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
  3691
     which uses #= (i.e. a Set or Dictionary)."
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3692
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3693
    ^ false
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3694
!
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3695
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3696
equalFromShortFloat:aShortFloat
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3697
    "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
  3698
     and return false from this comparison.
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3699
     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
  3700
     which uses #= (i.e. a Set or Dictionary)."
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3701
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3702
    ^ false
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3703
! !
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3704
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3705
!Object methodsFor:'encoding & decoding'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3706
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3707
decodeAsLiteralArray
8832
8210e23f6c32 Speed up #literalArrayEncoding
Stefan Vogel <sv@exept.de>
parents: 8829
diff changeset
  3708
    "given a literalEncoding in the receiver,
8210e23f6c32 Speed up #literalArrayEncoding
Stefan Vogel <sv@exept.de>
parents: 8829
diff changeset
  3709
     create & return the corresponding object.
8210e23f6c32 Speed up #literalArrayEncoding
Stefan Vogel <sv@exept.de>
parents: 8829
diff changeset
  3710
     The inverse operation to #literalArrayEncoding."
8210e23f6c32 Speed up #literalArrayEncoding
Stefan Vogel <sv@exept.de>
parents: 8829
diff changeset
  3711
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3712
    ^ self
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3713
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3714
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3715
encodeOn:anEncoder with:aParameter
8397
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  3716
    "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
  3717
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  3718
    <resource: #obsolete>
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  3719
8404
c0bd2a56dc3b *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 8397
diff changeset
  3720
    self acceptVisitor:anEncoder with:aParameter
6718
6d91ccd79d53 Encoding stuff
Stefan Vogel <sv@exept.de>
parents: 6716
diff changeset
  3721
!
6d91ccd79d53 Encoding stuff
Stefan Vogel <sv@exept.de>
parents: 6716
diff changeset
  3722
6d91ccd79d53 Encoding stuff
Stefan Vogel <sv@exept.de>
parents: 6716
diff changeset
  3723
encodingVectorForInstanceVariables
8397
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  3724
    "OBSOLETE, use elementDescriptorForInstanceVariables"
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  3725
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  3726
    <resource: #obsolete>
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  3727
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  3728
    ^ self elementDescriptorForInstanceVariablesMatching:[:val | true].
6718
6d91ccd79d53 Encoding stuff
Stefan Vogel <sv@exept.de>
parents: 6716
diff changeset
  3729
6d91ccd79d53 Encoding stuff
Stefan Vogel <sv@exept.de>
parents: 6716
diff changeset
  3730
    "
6d91ccd79d53 Encoding stuff
Stefan Vogel <sv@exept.de>
parents: 6716
diff changeset
  3731
      #(1 2 3 nil true symbol) encodingVectorForInstanceVariables
6d91ccd79d53 Encoding stuff
Stefan Vogel <sv@exept.de>
parents: 6716
diff changeset
  3732
      Dictionary new encodingVectorForInstanceVariables
6d91ccd79d53 Encoding stuff
Stefan Vogel <sv@exept.de>
parents: 6716
diff changeset
  3733
      (5 @ nil) encodingVectorForInstanceVariables
6d91ccd79d53 Encoding stuff
Stefan Vogel <sv@exept.de>
parents: 6716
diff changeset
  3734
    "
6d91ccd79d53 Encoding stuff
Stefan Vogel <sv@exept.de>
parents: 6716
diff changeset
  3735
!
6d91ccd79d53 Encoding stuff
Stefan Vogel <sv@exept.de>
parents: 6716
diff changeset
  3736
6d91ccd79d53 Encoding stuff
Stefan Vogel <sv@exept.de>
parents: 6716
diff changeset
  3737
encodingVectorForNonNilInstanceVariables
8397
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  3738
    "OBSOLETE, use elementDescriptorForNonNilInstanceVariables"
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  3739
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  3740
    <resource: #obsolete>
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  3741
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  3742
    ^ self elementDescriptorForInstanceVariablesMatching:[:varVal | varVal notNil].
6718
6d91ccd79d53 Encoding stuff
Stefan Vogel <sv@exept.de>
parents: 6716
diff changeset
  3743
6d91ccd79d53 Encoding stuff
Stefan Vogel <sv@exept.de>
parents: 6716
diff changeset
  3744
    "
6d91ccd79d53 Encoding stuff
Stefan Vogel <sv@exept.de>
parents: 6716
diff changeset
  3745
      #(1 2 3 nil true symbol) encodingVectorForNonNilInstanceVariables
6d91ccd79d53 Encoding stuff
Stefan Vogel <sv@exept.de>
parents: 6716
diff changeset
  3746
      (5 @ nil) encodingVectorForNonNilInstanceVariables
6d91ccd79d53 Encoding stuff
Stefan Vogel <sv@exept.de>
parents: 6716
diff changeset
  3747
    "
6d91ccd79d53 Encoding stuff
Stefan Vogel <sv@exept.de>
parents: 6716
diff changeset
  3748
!
6d91ccd79d53 Encoding stuff
Stefan Vogel <sv@exept.de>
parents: 6716
diff changeset
  3749
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3750
fromLiteralArrayEncoding:aSpecArray
8798
73676c762813 comment
Claus Gittinger <cg@exept.de>
parents: 8789
diff changeset
  3751
    "read my attributes from aSpecArray.
73676c762813 comment
Claus Gittinger <cg@exept.de>
parents: 8789
diff changeset
  3752
     Recursively decodes arguments."
73676c762813 comment
Claus Gittinger <cg@exept.de>
parents: 8789
diff changeset
  3753
73676c762813 comment
Claus Gittinger <cg@exept.de>
parents: 8789
diff changeset
  3754
    |sel litVal val
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3755
     stop   "{ Class:SmallInteger }" |
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3756
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3757
    stop := aSpecArray size.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3758
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3759
    2 to:stop by:2 do:[:i|
13812
Stefan Vogel <sv@exept.de>
parents: 13800
diff changeset
  3760
        sel := aSpecArray at:i.
Stefan Vogel <sv@exept.de>
parents: 13800
diff changeset
  3761
        litVal := aSpecArray at:i + 1.
Stefan Vogel <sv@exept.de>
parents: 13800
diff changeset
  3762
Stefan Vogel <sv@exept.de>
parents: 13800
diff changeset
  3763
        (self respondsTo:sel) ifTrue:[
Stefan Vogel <sv@exept.de>
parents: 13800
diff changeset
  3764
            val := litVal decodeAsLiteralArray.
Stefan Vogel <sv@exept.de>
parents: 13800
diff changeset
  3765
            self perform:sel with:val
Stefan Vogel <sv@exept.de>
parents: 13800
diff changeset
  3766
        ] ifFalse:[
Stefan Vogel <sv@exept.de>
parents: 13800
diff changeset
  3767
            Transcript show:self class name; show:': unhandled literalArrayEncoding attribute: '.
Stefan Vogel <sv@exept.de>
parents: 13800
diff changeset
  3768
            Transcript showCR:sel.
Stefan Vogel <sv@exept.de>
parents: 13800
diff changeset
  3769
Stefan Vogel <sv@exept.de>
parents: 13800
diff changeset
  3770
            "/ thats a debug halt,
Stefan Vogel <sv@exept.de>
parents: 13800
diff changeset
  3771
            "/ it should probably be removed (to simply ignore unhandled attributes)...
Stefan Vogel <sv@exept.de>
parents: 13800
diff changeset
  3772
            "/ for now, it is left in, in order to easily find incompatibilities between
Stefan Vogel <sv@exept.de>
parents: 13800
diff changeset
  3773
            "/ VW and ST/X.
13990
04500189908c changed: #fromLiteralArrayEncoding:
Claus Gittinger <cg@exept.de>
parents: 13849
diff changeset
  3774
            self breakPoint:#cg.
13812
Stefan Vogel <sv@exept.de>
parents: 13800
diff changeset
  3775
        ]
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3776
    ]
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3777
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3778
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3779
literalArrayEncoding
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3780
    "generate a literalArrayEncoding array for myself.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3781
     This uses #literalArrayEncodingSlotOrder which defines the slots and
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3782
     order and #skippedInLiteralEncoding which defines slots to skip.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3783
     For most subclasses, there is no need to redefine those."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3784
8832
8210e23f6c32 Speed up #literalArrayEncoding
Stefan Vogel <sv@exept.de>
parents: 8829
diff changeset
  3785
    |names encoding cls skipped slots|
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3786
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3787
    self isLiteral ifTrue:[
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  3788
        ^ self
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3789
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3790
8832
8210e23f6c32 Speed up #literalArrayEncoding
Stefan Vogel <sv@exept.de>
parents: 8829
diff changeset
  3791
    slots    := self literalArrayEncodingSlotOrder.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3792
    skipped  := self skippedInLiteralEncoding.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3793
    cls      := self class.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3794
    names    := cls allInstVarNames.
8832
8210e23f6c32 Speed up #literalArrayEncoding
Stefan Vogel <sv@exept.de>
parents: 8829
diff changeset
  3795
    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
  3796
    encoding add:cls name.
8832
8210e23f6c32 Speed up #literalArrayEncoding
Stefan Vogel <sv@exept.de>
parents: 8829
diff changeset
  3797
8210e23f6c32 Speed up #literalArrayEncoding
Stefan Vogel <sv@exept.de>
parents: 8829
diff changeset
  3798
    slots do:[:instSlot |
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  3799
        |value nm|
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  3800
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  3801
        nm := names at:instSlot.
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  3802
        (skipped includes:nm) ifFalse:[
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  3803
            (value := self instVarAt:instSlot) notNil ifTrue:[
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  3804
                encoding add:(nm , ':') asSymbol.
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  3805
                encoding add:value literalArrayEncoding
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  3806
            ]
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  3807
        ]
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3808
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3809
    ^ encoding asArray
8841
d5acf50ec5a6 Comment
Stefan Vogel <sv@exept.de>
parents: 8839
diff changeset
  3810
d5acf50ec5a6 Comment
Stefan Vogel <sv@exept.de>
parents: 8839
diff changeset
  3811
    "
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  3812
        (1 -> 2) literalArrayEncoding
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  3813
        DebugView menuSpec decodeAsLiteralArray literalArrayEncoding  =
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  3814
           DebugView menuSpec
8841
d5acf50ec5a6 Comment
Stefan Vogel <sv@exept.de>
parents: 8839
diff changeset
  3815
    "
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3816
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3817
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3818
literalArrayEncodingSlotOrder
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3819
    "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
  3820
     a literalArrayEncoding"
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  3821
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3822
    ^ 1 to:self class instSize
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3823
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3824
7112
6299f5d9129c added postDecodeFrom - to allow for an object to
martin
parents: 7094
diff changeset
  3825
postDecodeFrom:aDecoder aspect:aspectSymbol
6299f5d9129c added postDecodeFrom - to allow for an object to
martin
parents: 7094
diff changeset
  3826
    "invoked by xmlDecoder (and others in the future), after an
6299f5d9129c added postDecodeFrom - to allow for an object to
martin
parents: 7094
diff changeset
  3827
     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
  3828
8397
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  3829
    ^ self
7112
6299f5d9129c added postDecodeFrom - to allow for an object to
martin
parents: 7094
diff changeset
  3830
!
6299f5d9129c added postDecodeFrom - to allow for an object to
martin
parents: 7094
diff changeset
  3831
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3832
skippedInLiteralEncoding
8397
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  3833
    "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
  3834
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3835
    ^ #()
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3836
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3837
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3838
!Object methodsFor:'error handling'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3839
13416
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  3840
ambiguousMessage:aMessage
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  3841
    "this message is sent by the system in case that it
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  3842
     is not clear which method to execute in response to
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  3843
     aMessage. 
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  3844
     Such situation may occur when a current selector namespace
14478
4ff5aab56d26 more specific error reporting for type errors
Claus Gittinger <cg@exept.de>
parents: 14369
diff changeset
  3845
     imports two namespaces and both define a method with the
13416
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  3846
     requested selector."
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  3847
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  3848
    <context: #return>
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  3849
    <resource: #skipInDebuggersWalkBack>
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  3850
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  3851
    ^ AmbiguousMessage raiseRequestWith:aMessage
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  3852
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  3853
    "Created: / 21-07-2010 / 15:44:20 / Jan Vrany <jan.vrany@fit.cvut.cz>"
14478
4ff5aab56d26 more specific error reporting for type errors
Claus Gittinger <cg@exept.de>
parents: 14369
diff changeset
  3854
    "Modified (comment): / 02-11-2012 / 10:14:42 / cg"
13416
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  3855
!
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  3856
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3857
appropriateDebugger:aSelector
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3858
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3859
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3860
    "return an appropriate debugger to use.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3861
     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
  3862
     the DebugView, return MiniDebugger (as a last chance) otherwise abort."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3863
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3864
    |context|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3865
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3866
    "DebugView cannot run without system processes"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3867
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  3868
    (Processor isNil
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3869
    or:[Processor activeProcessIsSystemProcess
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3870
    or:[Smalltalk isInitialized not]]) ifTrue:[
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  3871
        ^ MiniDebugger
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3872
    ].
6778
87e2d95ce8a4 Raise #drawingOnClosedDeviceSignal instead of #error
Stefan Vogel <sv@exept.de>
parents: 6764
diff changeset
  3873
    (Screen isNil or:[Screen default isNil or:[Screen default isOpen not]]) ifTrue:[
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  3874
        Debugger isNil ifTrue:[^ nil].
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  3875
        ^ MiniDebugger
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3876
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3877
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3878
    context := thisContext.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3879
    context := context findNextContextWithSelector:aSelector or:nil or:nil.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3880
    [context notNil] whileTrue:[
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  3881
        ((context receiver class == Debugger)
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  3882
         and:[context selector == aSelector]) ifTrue:[
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  3883
            "we are already in some Debugger"
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  3884
            (Debugger == MiniDebugger) ifTrue:[
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  3885
                "we are already in the MiniDebugger"
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  3886
                ErrorRecursion ifFalse:[
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  3887
                    Smalltalk fatalAbort:'recursive error ...'
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  3888
                ]
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  3889
            ].
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  3890
            MiniDebugger isNil ifTrue:[
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  3891
                Smalltalk fatalAbort:'no debugger'
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  3892
            ].
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  3893
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  3894
            "ok, an error occured while in the graphical debugger;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  3895
             lets try MiniDebugger"
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  3896
            ^ MiniDebugger
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  3897
        ].
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  3898
        context := context findNextContextWithSelector:aSelector or:nil or:nil.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3899
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3900
    "not within Debugger - no problem"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3901
    ^ Debugger
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3902
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3903
    "Modified: / 23.9.1996 / 12:14:52 / stefan"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3904
    "Modified: / 19.5.1999 / 18:05:00 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3905
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3906
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3907
cannotSendMessage:aMessage to:someReceiver
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3908
    "this message is sent by the runtime system (VM),
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3909
     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
  3910
     a valid behavior (see documentation in Behavior)."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3911
11021
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  3912
    <resource: #skipInDebuggersWalkBack>
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  3913
8330
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
  3914
    ^ VMInternalError
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  3915
          raiseWith:someReceiver
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  3916
          errorString:('bad class in send of #' , aMessage selector)
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
    "Modified: 23.1.1997 / 00:05:39 / cg"
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
11132
e5bd3a66ca80 conversion errors (specific error classes)
Claus Gittinger <cg@exept.de>
parents: 11068
diff changeset
  3921
conversionErrorSignal
e5bd3a66ca80 conversion errors (specific error classes)
Claus Gittinger <cg@exept.de>
parents: 11068
diff changeset
  3922
    "return the signal used for conversion error handling"
e5bd3a66ca80 conversion errors (specific error classes)
Claus Gittinger <cg@exept.de>
parents: 11068
diff changeset
  3923
e5bd3a66ca80 conversion errors (specific error classes)
Claus Gittinger <cg@exept.de>
parents: 11068
diff changeset
  3924
    ^ self class conversionErrorSignal
e5bd3a66ca80 conversion errors (specific error classes)
Claus Gittinger <cg@exept.de>
parents: 11068
diff changeset
  3925
!
e5bd3a66ca80 conversion errors (specific error classes)
Claus Gittinger <cg@exept.de>
parents: 11068
diff changeset
  3926
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3927
doesNotUnderstand:aMessage
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3928
    "this message is sent by the runtime system (VM) when
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3929
     a message is not understood by some object (i.e. there
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3930
     is no method for that selector). The original message has
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3931
     been packed into aMessage (i.e. the receiver, selector and
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3932
     any arguments) and the original receiver is then sent the
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3933
     #doesNotUnderstand: message.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3934
     Here, we raise another signal which usually enters the debugger.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3935
     You can of course redefine #doesNotUnderstand: in your classes
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  3936
     to implement message delegation,
8500
10d47cede03c Speed up MessageNotUnderstood exception sending by layz computation
Stefan Vogel <sv@exept.de>
parents: 8481
diff changeset
  3937
     or handle the MessageNotUnderstood exception gracefully."
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3938
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3939
    <context: #return>
11021
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  3940
    <resource: #skipInDebuggersWalkBack>
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3941
8500
10d47cede03c Speed up MessageNotUnderstood exception sending by layz computation
Stefan Vogel <sv@exept.de>
parents: 8481
diff changeset
  3942
    ^ MessageNotUnderstood raiseRequestWith:aMessage
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3943
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3944
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3945
elementBoundsError
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3946
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3947
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  3948
    "report an error that badElement is out of bounds
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3949
     (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
  3950
     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
  3951
11021
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  3952
    <resource: #skipInDebuggersWalkBack>
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  3953
8330
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
  3954
    ^ ElementBoundsError raise
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3955
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3956
    "Modified: 8.5.1996 / 09:12:45 / cg"
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
7215
733294e1a8cc correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 7211
diff changeset
  3959
elementBoundsError:aValue
733294e1a8cc correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 7211
diff changeset
  3960
    "{ Pragma: +optSpace }"
733294e1a8cc correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 7211
diff changeset
  3961
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  3962
    "report an error that aValue is not valid as element
7215
733294e1a8cc correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 7211
diff changeset
  3963
     (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
  3964
     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
  3965
11021
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  3966
    <resource: #skipInDebuggersWalkBack>
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  3967
8330
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
  3968
    ^ ElementBoundsError raiseWith:aValue
7215
733294e1a8cc correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 7211
diff changeset
  3969
733294e1a8cc correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 7211
diff changeset
  3970
    "Modified: 8.5.1996 / 09:12:45 / cg"
733294e1a8cc correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 7211
diff changeset
  3971
!
733294e1a8cc correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 7211
diff changeset
  3972
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3973
elementNotCharacter
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3974
    "{ Pragma: +optSpace }"
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
    "report an error that object to be stored is no Character.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3977
     (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
  3978
     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
  3979
11021
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  3980
    <resource: #skipInDebuggersWalkBack>
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  3981
8330
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
  3982
    ^ ElementBoundsError raise
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3983
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3984
    "Modified: 8.5.1996 / 09:12:49 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3985
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3986
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3987
elementNotInteger
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3988
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3989
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3990
    "report an error that object to be stored is not Integer.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3991
     (in collections that store integers only).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3992
     The error is reported by raising the ElementOutOfBoundsSignal exception."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3993
11021
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  3994
    <resource: #skipInDebuggersWalkBack>
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  3995
8330
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
  3996
    ^ ElementBoundsError raise
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3997
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3998
    "Modified: 8.5.1996 / 09:12:51 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3999
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4000
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4001
error
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4002
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4003
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4004
    "report error that an error occured.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4005
     The error is reported by raising the Error exception,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4006
     which is non-proceedable.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4007
     If no handler has been setup, a debugger is entered."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4008
11021
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4009
    <context: #return>
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4010
    <resource: #skipInDebuggersWalkBack>
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4011
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4012
    Error raiseWith:#error:
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4013
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4014
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4015
     nil error
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4016
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4017
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4018
    "Modified: / 8.5.1996 / 09:13:01 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4019
    "Modified: / 2.8.1999 / 17:00:19 / stefan"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4020
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4021
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4022
error:aString
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4023
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4024
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4025
    "Raise an error with error message aString.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4026
     The error is reported by raising the Error exception,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4027
     which is non-proceedable.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4028
     If no handler has been setup, a debugger is entered."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4029
11021
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4030
    <context: #return>
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4031
    <resource: #skipInDebuggersWalkBack>
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4032
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  4033
    Error raiseWith:#error: errorString:aString
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4034
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4035
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4036
      nil error:' bad bad bad'
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4037
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4038
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4039
    "Modified: 8.5.1996 / 09:13:04 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4040
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4041
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4042
error:aString mayProceed:mayProceed
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4043
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4044
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4045
    "enter debugger with error-message aString.
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  4046
     The error is reported by raising either the
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4047
     non-proceedable Error exception,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4048
     or the ProceedableError exception."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4049
11021
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4050
    <resource: #skipInDebuggersWalkBack>
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4051
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4052
    mayProceed ifTrue:[
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  4053
        ^ ProceedableError raiseRequestWith:#error: errorString:aString
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  4054
    ].
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  4055
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  4056
    Error raiseWith:#error: errorString:aString
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4057
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4058
    "Modified: 8.5.1996 / 09:13:04 / cg"
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
6900
3b1eafe032b2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6884
diff changeset
  4061
errorInvalidFormat
3b1eafe032b2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6884
diff changeset
  4062
    "{ Pragma: +optSpace }"
3b1eafe032b2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6884
diff changeset
  4063
3b1eafe032b2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6884
diff changeset
  4064
    "report an error that some conversion to/from string representation failed
3b1eafe032b2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6884
diff changeset
  4065
     typically when converting numbers, date, time etc."
3b1eafe032b2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6884
diff changeset
  4066
11021
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4067
    <context: #return>
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4068
    <resource: #skipInDebuggersWalkBack>
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4069
6900
3b1eafe032b2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6884
diff changeset
  4070
    ^ ConversionError raiseErrorString:'invalid format'
3b1eafe032b2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6884
diff changeset
  4071
!
3b1eafe032b2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6884
diff changeset
  4072
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4073
errorKeyNotFound:aKey
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4074
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4075
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4076
    "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
  4077
     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
  4078
11021
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4079
    <resource: #skipInDebuggersWalkBack>
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4080
10918
a4635305501e #instVarNamed* - raise KeyNotFoundError if an instaver does not exist
Stefan Vogel <sv@exept.de>
parents: 10877
diff changeset
  4081
    ^ KeyNotFoundError raiseRequestWith:aKey errorString:(' ', aKey printString)
8330
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
  4082
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
  4083
    "
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
  4084
     Dictionary new at:#nonExistantElement
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4085
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4086
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4087
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4088
errorNotFound
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4089
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4090
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4091
    "report an error that no element was found in a collection.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4092
     The error is reported by raising the NotFoundSignal exception."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4093
11021
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4094
    <resource: #skipInDebuggersWalkBack>
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4095
6946
905fcfc8699b signal-classVars replaced by error-class access
Claus Gittinger <cg@exept.de>
parents: 6932
diff changeset
  4096
    ^ NotFoundError raiseRequestWith:nil
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4097
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4098
    "Modified: / 8.5.1996 / 09:13:11 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4099
    "Modified: / 26.7.1999 / 10:51:50 / stefan"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4100
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4101
6874
c539a4c44df1 +errorNotFound:
Claus Gittinger <cg@exept.de>
parents: 6845
diff changeset
  4102
errorNotFound:errorString
c539a4c44df1 +errorNotFound:
Claus Gittinger <cg@exept.de>
parents: 6845
diff changeset
  4103
    "{ Pragma: +optSpace }"
c539a4c44df1 +errorNotFound:
Claus Gittinger <cg@exept.de>
parents: 6845
diff changeset
  4104
c539a4c44df1 +errorNotFound:
Claus Gittinger <cg@exept.de>
parents: 6845
diff changeset
  4105
    "report an error that no element was found in a collection.
c539a4c44df1 +errorNotFound:
Claus Gittinger <cg@exept.de>
parents: 6845
diff changeset
  4106
     The error is reported by raising the NotFoundSignal exception."
c539a4c44df1 +errorNotFound:
Claus Gittinger <cg@exept.de>
parents: 6845
diff changeset
  4107
11021
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4108
    <resource: #skipInDebuggersWalkBack>
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4109
10837
63d19c75d762 changed #errorNotFound: raise it proceedable
Stefan Vogel <sv@exept.de>
parents: 10834
diff changeset
  4110
    ^ NotFoundError raiseRequestErrorString:errorString
6874
c539a4c44df1 +errorNotFound:
Claus Gittinger <cg@exept.de>
parents: 6845
diff changeset
  4111
!
c539a4c44df1 +errorNotFound:
Claus Gittinger <cg@exept.de>
parents: 6845
diff changeset
  4112
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4113
errorSignal
11132
e5bd3a66ca80 conversion errors (specific error classes)
Claus Gittinger <cg@exept.de>
parents: 11068
diff changeset
  4114
    "return the signal used for error/error: handling"
e5bd3a66ca80 conversion errors (specific error classes)
Claus Gittinger <cg@exept.de>
parents: 11068
diff changeset
  4115
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4116
    ^ self class errorSignal
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4117
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4118
    "Created: / 19.6.1998 / 02:32:32 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4119
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4120
7322
178e33c2a376 catch non-block/non-signal/non-exception being
Claus Gittinger <cg@exept.de>
parents: 7320
diff changeset
  4121
handlerForSignal:exceptionHandler context:theContext originator:originator
178e33c2a376 catch non-block/non-signal/non-exception being
Claus Gittinger <cg@exept.de>
parents: 7320
diff changeset
  4122
    " 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
  4123
7566
f691eac0f114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7562
diff changeset
  4124
    thisContext isRecursive ifTrue:[^ nil].
f691eac0f114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7562
diff changeset
  4125
7322
178e33c2a376 catch non-block/non-signal/non-exception being
Claus Gittinger <cg@exept.de>
parents: 7320
diff changeset
  4126
    '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
  4127
    '         context: ' print. theContext printCR.
178e33c2a376 catch non-block/non-signal/non-exception being
Claus Gittinger <cg@exept.de>
parents: 7320
diff changeset
  4128
    '         originator: ' print. originator printCR.
178e33c2a376 catch non-block/non-signal/non-exception being
Claus Gittinger <cg@exept.de>
parents: 7320
diff changeset
  4129
    '         sender: ' print. thisContext sender printCR.
178e33c2a376 catch non-block/non-signal/non-exception being
Claus Gittinger <cg@exept.de>
parents: 7320
diff changeset
  4130
7566
f691eac0f114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7562
diff changeset
  4131
    "/ MiniDebugger enter:thisContext withMessage:'oops' mayProceed:true.
f691eac0f114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7562
diff changeset
  4132
    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
  4133
!
178e33c2a376 catch non-block/non-signal/non-exception being
Claus Gittinger <cg@exept.de>
parents: 7320
diff changeset
  4134
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4135
implementedBySubclass
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4136
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4137
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4138
    "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
  4139
11021
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4140
    <resource: #skipInDebuggersWalkBack>
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4141
12322
a8a569a96301 changed:
Claus Gittinger <cg@exept.de>
parents: 12321
diff changeset
  4142
    ^ SubclassResponsibilityError raiseRequestErrorString:'method must be reimplemented in ST/V subclass'
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4143
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4144
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4145
indexNotInteger
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4146
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4147
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4148
    "report an error that index is not an Integer.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4149
     (when accessing collections indexed by an integer key).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4150
     The error is reported by raising the NonIntegerIndexSignal exception."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4151
11021
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4152
    <resource: #skipInDebuggersWalkBack>
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4153
6946
905fcfc8699b signal-classVars replaced by error-class access
Claus Gittinger <cg@exept.de>
parents: 6932
diff changeset
  4154
    ^ NonIntegerIndexError raiseRequestWith:nil
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4155
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4156
    "Modified: / 8.5.1996 / 09:13:37 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4157
    "Modified: / 26.7.1999 / 10:57:43 / stefan"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4158
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4159
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4160
indexNotInteger:anIndex
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4161
    "{ Pragma: +optSpace }"
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
    "report an error that index is not an Integer.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4164
     (when accessing collections indexed by an integer key).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4165
     The error is reported by raising the NonIntegerIndexSignal exception."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4166
11021
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4167
    <resource: #skipInDebuggersWalkBack>
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4168
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  4169
    ^ NonIntegerIndexError raiseRequestWith:anIndex
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4170
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4171
    "Created: / 16.5.1998 / 19:39:41 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4172
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4173
7216
59bfa2ffdcf7 utility
Claus Gittinger <cg@exept.de>
parents: 7215
diff changeset
  4174
indexNotIntegerOrOutOfBounds:index
59bfa2ffdcf7 utility
Claus Gittinger <cg@exept.de>
parents: 7215
diff changeset
  4175
    "{ Pragma: +optSpace }"
59bfa2ffdcf7 utility
Claus Gittinger <cg@exept.de>
parents: 7215
diff changeset
  4176
59bfa2ffdcf7 utility
Claus Gittinger <cg@exept.de>
parents: 7215
diff changeset
  4177
    "report an error that index is either non-integral or out of bounds"
59bfa2ffdcf7 utility
Claus Gittinger <cg@exept.de>
parents: 7215
diff changeset
  4178
11021
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4179
    <resource: #skipInDebuggersWalkBack>
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4180
7216
59bfa2ffdcf7 utility
Claus Gittinger <cg@exept.de>
parents: 7215
diff changeset
  4181
    index isInteger ifFalse:[
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  4182
        ^ self indexNotInteger:index
7216
59bfa2ffdcf7 utility
Claus Gittinger <cg@exept.de>
parents: 7215
diff changeset
  4183
    ].
59bfa2ffdcf7 utility
Claus Gittinger <cg@exept.de>
parents: 7215
diff changeset
  4184
    ^ self subscriptBoundsError:index
59bfa2ffdcf7 utility
Claus Gittinger <cg@exept.de>
parents: 7215
diff changeset
  4185
!
59bfa2ffdcf7 utility
Claus Gittinger <cg@exept.de>
parents: 7215
diff changeset
  4186
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4187
integerCheckError
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4188
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4189
12321
ff74d7eab313 added: #shouldImplement:
Claus Gittinger <cg@exept.de>
parents: 12288
diff changeset
  4190
    "generated when a variable declared with an integer type gets a bad value assigned"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4191
11021
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4192
    <resource: #skipInDebuggersWalkBack>
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4193
14478
4ff5aab56d26 more specific error reporting for type errors
Claus Gittinger <cg@exept.de>
parents: 14369
diff changeset
  4194
"/    ^ self error:'bad assign of ' , self printString ,
4ff5aab56d26 more specific error reporting for type errors
Claus Gittinger <cg@exept.de>
parents: 14369
diff changeset
  4195
"/                  ' (' , self class name , ') to integer-typed variable'
4ff5aab56d26 more specific error reporting for type errors
Claus Gittinger <cg@exept.de>
parents: 14369
diff changeset
  4196
    ^ InvalidTypeError 
4ff5aab56d26 more specific error reporting for type errors
Claus Gittinger <cg@exept.de>
parents: 14369
diff changeset
  4197
        raiseRequestErrorString:(
4ff5aab56d26 more specific error reporting for type errors
Claus Gittinger <cg@exept.de>
parents: 14369
diff changeset
  4198
            'bad assign of ' , self printString ,
4ff5aab56d26 more specific error reporting for type errors
Claus Gittinger <cg@exept.de>
parents: 14369
diff changeset
  4199
                  ' (' , self class name , ') to integer-typed variable')
4ff5aab56d26 more specific error reporting for type errors
Claus Gittinger <cg@exept.de>
parents: 14369
diff changeset
  4200
4ff5aab56d26 more specific error reporting for type errors
Claus Gittinger <cg@exept.de>
parents: 14369
diff changeset
  4201
    "Modified: / 02-11-2012 / 10:25:36 / cg"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4202
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4203
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4204
invalidCodeObject
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4205
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4206
12321
ff74d7eab313 added: #shouldImplement:
Claus Gittinger <cg@exept.de>
parents: 12288
diff changeset
  4207
    "this is sent by VM if it encounters some non-method for execution"
ff74d7eab313 added: #shouldImplement:
Claus Gittinger <cg@exept.de>
parents: 12288
diff changeset
  4208
11021
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4209
    <resource: #skipInDebuggersWalkBack>
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4210
14478
4ff5aab56d26 more specific error reporting for type errors
Claus Gittinger <cg@exept.de>
parents: 14369
diff changeset
  4211
    "/ self error:'not an executable code object'
4ff5aab56d26 more specific error reporting for type errors
Claus Gittinger <cg@exept.de>
parents: 14369
diff changeset
  4212
    ^ ExecutionError 
4ff5aab56d26 more specific error reporting for type errors
Claus Gittinger <cg@exept.de>
parents: 14369
diff changeset
  4213
        raiseRequestErrorString:'not an executable code object'
4ff5aab56d26 more specific error reporting for type errors
Claus Gittinger <cg@exept.de>
parents: 14369
diff changeset
  4214
4ff5aab56d26 more specific error reporting for type errors
Claus Gittinger <cg@exept.de>
parents: 14369
diff changeset
  4215
    "Created: / 01-08-1997 / 00:16:44 / cg"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4216
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4217
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  4218
invalidMessage
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4219
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4220
14478
4ff5aab56d26 more specific error reporting for type errors
Claus Gittinger <cg@exept.de>
parents: 14369
diff changeset
  4221
    "this is sent by ST/V code - it's the same as #shouldNotImplement"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4222
11021
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4223
    <resource: #skipInDebuggersWalkBack>
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4224
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4225
    ^ self shouldNotImplement
14478
4ff5aab56d26 more specific error reporting for type errors
Claus Gittinger <cg@exept.de>
parents: 14369
diff changeset
  4226
4ff5aab56d26 more specific error reporting for type errors
Claus Gittinger <cg@exept.de>
parents: 14369
diff changeset
  4227
    "Modified (comment): / 02-11-2012 / 10:11:18 / cg"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4228
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4229
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4230
mustBeRectangle
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4231
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4232
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4233
    "report an argument-not-rectangle-error"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4234
11021
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4235
    <resource: #skipInDebuggersWalkBack>
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4236
14478
4ff5aab56d26 more specific error reporting for type errors
Claus Gittinger <cg@exept.de>
parents: 14369
diff changeset
  4237
    "/ ^ self error:'argument must be a Rectangle'
4ff5aab56d26 more specific error reporting for type errors
Claus Gittinger <cg@exept.de>
parents: 14369
diff changeset
  4238
    ^ InvalidTypeError
4ff5aab56d26 more specific error reporting for type errors
Claus Gittinger <cg@exept.de>
parents: 14369
diff changeset
  4239
        raiseRequestErrorString:'argument must be a Rectangle'
4ff5aab56d26 more specific error reporting for type errors
Claus Gittinger <cg@exept.de>
parents: 14369
diff changeset
  4240
4ff5aab56d26 more specific error reporting for type errors
Claus Gittinger <cg@exept.de>
parents: 14369
diff changeset
  4241
    "Modified: / 02-11-2012 / 10:24:53 / cg"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4242
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4243
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4244
mustBeString
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4245
    "{ Pragma: +optSpace }"
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
    "report an argument-not-string-error"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4248
11021
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4249
    <resource: #skipInDebuggersWalkBack>
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4250
14478
4ff5aab56d26 more specific error reporting for type errors
Claus Gittinger <cg@exept.de>
parents: 14369
diff changeset
  4251
    "/ ^ self error:'argument must be a String'
4ff5aab56d26 more specific error reporting for type errors
Claus Gittinger <cg@exept.de>
parents: 14369
diff changeset
  4252
    ^ InvalidTypeError
4ff5aab56d26 more specific error reporting for type errors
Claus Gittinger <cg@exept.de>
parents: 14369
diff changeset
  4253
        raiseRequestErrorString:'argument must be a String'
4ff5aab56d26 more specific error reporting for type errors
Claus Gittinger <cg@exept.de>
parents: 14369
diff changeset
  4254
4ff5aab56d26 more specific error reporting for type errors
Claus Gittinger <cg@exept.de>
parents: 14369
diff changeset
  4255
    "Modified: / 02-11-2012 / 10:24:35 / cg"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4256
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4257
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4258
notIndexed
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4259
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4260
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4261
    "report an error that receiver has no indexed instance variables.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4262
     The error is reported by raising the SubscriptOutOfBoundsSignal exception."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4263
11021
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4264
    <context: #return>
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4265
    <resource: #skipInDebuggersWalkBack>
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4266
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  4267
    ^ SubscriptOutOfBoundsError
14499
6ed948158d25 class: Object
Claus Gittinger <cg@exept.de>
parents: 14478
diff changeset
  4268
        raiseRequestErrorString:'receiver has no indexed variables'
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4269
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4270
    "Modified: 26.7.1996 / 16:43:13 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4271
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4272
12050
bd0013f79e4f added: #notYetImplemented
Claus Gittinger <cg@exept.de>
parents: 11976
diff changeset
  4273
notYetImplemented
bd0013f79e4f added: #notYetImplemented
Claus Gittinger <cg@exept.de>
parents: 11976
diff changeset
  4274
    "{ Pragma: +optSpace }"
bd0013f79e4f added: #notYetImplemented
Claus Gittinger <cg@exept.de>
parents: 11976
diff changeset
  4275
12321
ff74d7eab313 added: #shouldImplement:
Claus Gittinger <cg@exept.de>
parents: 12288
diff changeset
  4276
    "report an error that some functionality is not yet implemented.
ff74d7eab313 added: #shouldImplement:
Claus Gittinger <cg@exept.de>
parents: 12288
diff changeset
  4277
     This is here only for compatibility - it has the same meaning as shouldImplement."
12050
bd0013f79e4f added: #notYetImplemented
Claus Gittinger <cg@exept.de>
parents: 11976
diff changeset
  4278
bd0013f79e4f added: #notYetImplemented
Claus Gittinger <cg@exept.de>
parents: 11976
diff changeset
  4279
    <resource: #skipInDebuggersWalkBack>
bd0013f79e4f added: #notYetImplemented
Claus Gittinger <cg@exept.de>
parents: 11976
diff changeset
  4280
14478
4ff5aab56d26 more specific error reporting for type errors
Claus Gittinger <cg@exept.de>
parents: 14369
diff changeset
  4281
    "/ ^ self error:'method/functionality is not yet implemented'
4ff5aab56d26 more specific error reporting for type errors
Claus Gittinger <cg@exept.de>
parents: 14369
diff changeset
  4282
    ^ MethodNotAppropriateError 
4ff5aab56d26 more specific error reporting for type errors
Claus Gittinger <cg@exept.de>
parents: 14369
diff changeset
  4283
        raiseRequestErrorString:'method/functionality is not yet implemented'
4ff5aab56d26 more specific error reporting for type errors
Claus Gittinger <cg@exept.de>
parents: 14369
diff changeset
  4284
4ff5aab56d26 more specific error reporting for type errors
Claus Gittinger <cg@exept.de>
parents: 14369
diff changeset
  4285
    "Modified: / 02-11-2012 / 10:24:12 / cg"
12050
bd0013f79e4f added: #notYetImplemented
Claus Gittinger <cg@exept.de>
parents: 11976
diff changeset
  4286
!
bd0013f79e4f added: #notYetImplemented
Claus Gittinger <cg@exept.de>
parents: 11976
diff changeset
  4287
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4288
openDebuggerOnException:ex
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4289
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4290
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4291
    "enter the debugger on some unhandled exception"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4292
6884
de5e191dbfaf more standAlone support
Claus Gittinger <cg@exept.de>
parents: 6877
diff changeset
  4293
    |msgString debugger answer|
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4294
11314
0b6e06b60ebe changed the error-notifier for standAlone apps.
Claus Gittinger <cg@exept.de>
parents: 11244
diff changeset
  4295
    msgString := ex descriptionForDebugger.
11236
c196f9dedf66 exception description in debugger
Claus Gittinger <cg@exept.de>
parents: 11221
diff changeset
  4296
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
     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
  4299
     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
  4300
     ignore will raise an AbortOperationRequest.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4301
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4302
    Debugger isNil ifTrue:[
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  4303
        msgString := 'Error: ' , msgString.
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  4304
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  4305
        thisContext isRecursive ifTrue:[
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  4306
            msgString errorPrintCR.
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  4307
            Smalltalk fatalAbort:'recursive unhandled exception'
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  4308
        ].
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  4309
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  4310
        Smalltalk isStandAloneApp ifTrue:[
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  4311
            (ex signal == NoHandlerError and:[HaltInterrupt handles:ex unhandledException]) ifTrue:[
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  4312
                "/ 'Halt ignored' infoPrintCR.
13848
3bb093f6a54d changed: #openDebuggerOnException:
Claus Gittinger <cg@exept.de>
parents: 13846
diff changeset
  4313
                ^ nil
3bb093f6a54d changed: #openDebuggerOnException:
Claus Gittinger <cg@exept.de>
parents: 13846
diff changeset
  4314
            ].
13849
01e27cdbf2bb changed: #openDebuggerOnException:
Claus Gittinger <cg@exept.de>
parents: 13848
diff changeset
  4315
            "don't output the message, if the exception is a UserInterrupt (CTRL-C)"
01e27cdbf2bb changed: #openDebuggerOnException:
Claus Gittinger <cg@exept.de>
parents: 13848
diff changeset
  4316
            (ex signal == NoHandlerError
01e27cdbf2bb changed: #openDebuggerOnException:
Claus Gittinger <cg@exept.de>
parents: 13848
diff changeset
  4317
             and:[ex unhandledException signal == UserInterrupt]) ifTrue:[
13848
3bb093f6a54d changed: #openDebuggerOnException:
Claus Gittinger <cg@exept.de>
parents: 13846
diff changeset
  4318
                ex description errorPrintCR.
13849
01e27cdbf2bb changed: #openDebuggerOnException:
Claus Gittinger <cg@exept.de>
parents: 13848
diff changeset
  4319
                OperatingSystem exit:130.
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  4320
            ].
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  4321
        ].
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  4322
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  4323
        (Dialog notNil and:[Screen default notNil]) ifTrue:[
11314
0b6e06b60ebe changed the error-notifier for standAlone apps.
Claus Gittinger <cg@exept.de>
parents: 11244
diff changeset
  4324
false "oldCode" ifTrue:[
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  4325
            AbortOperationRequest isHandled ifTrue:[
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  4326
                answer := OptionBox
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  4327
                        request:msgString
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  4328
                        label:msgString
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  4329
                        buttonLabels:#('Exit' 'Terminate Thread' 'Ignore' 'Abort' )
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  4330
                        values:#(exit terminate ignore abort)
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  4331
                        default:#abort.
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  4332
            ] ifFalse:[
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  4333
                answer := OptionBox
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  4334
                        request:msgString
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  4335
                        label:msgString
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  4336
                        buttonLabels:#('Exit' 'Terminate Thread' 'Ignore' )
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  4337
                        values:#(exit terminate ignore )
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  4338
                        default:#terminate.
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  4339
            ].
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  4340
            answer isNil ifTrue:[ answer := #ignore].
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  4341
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  4342
            answer == #abort ifTrue:[
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  4343
                ^ AbortOperationRequest raiseRequest
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  4344
            ].
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  4345
            answer == #ignore ifTrue:[
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  4346
                ^ nil
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  4347
            ].
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  4348
            answer == #terminate ifTrue:[
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  4349
                Processor activeProcess isSystemProcess ifTrue:[
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  4350
                    (Dialog confirm:'Are you sure (this might finish the application)') ifFalse:[
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  4351
                        ^ nil
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  4352
                    ].
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  4353
                ].
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  4354
                ^ Processor activeProcess terminate.
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  4355
            ].
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  4356
            "asking second time here to prevent the user from accidently closing his app"
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  4357
            answer == #exit ifTrue:[
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  4358
                answer := OptionBox
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  4359
                        request:'Do you really wish to exit this application (all changes will be lost)?'
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  4360
                        label:msgString
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  4361
                        buttonLabels:#('Yes' 'No' )
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  4362
                        values:#(exit abort)
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  4363
                        default:#abort.
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  4364
            ].
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  4365
            answer == #abort ifTrue:[
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  4366
                ^ AbortOperationRequest raiseRequest
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  4367
            ].
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  4368
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  4369
            (Dialog confirm:'Are you sure you want to finish the application ?') ifFalse:[
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  4370
                ^ nil
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  4371
            ].
11314
0b6e06b60ebe changed the error-notifier for standAlone apps.
Claus Gittinger <cg@exept.de>
parents: 11244
diff changeset
  4372
] ifFalse:[
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  4373
            self
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  4374
                errorNotify:msgString
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  4375
                from:ex suspendedContext
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  4376
                allowDebug:false.
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  4377
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  4378
            "/ arrive here if proceeded...
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  4379
            ^ nil
11314
0b6e06b60ebe changed the error-notifier for standAlone apps.
Claus Gittinger <cg@exept.de>
parents: 11244
diff changeset
  4380
].
0b6e06b60ebe changed the error-notifier for standAlone apps.
Claus Gittinger <cg@exept.de>
parents: 11244
diff changeset
  4381
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  4382
        ].
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  4383
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  4384
        "don't output the message, if the exception is a UserInterrupt (CTRL-C)"
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  4385
        (ex signal == NoHandlerError
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  4386
         and:[ex unhandledException signal == UserInterrupt]) ifTrue:[
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  4387
            OperatingSystem exit:130.
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  4388
        ].
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  4389
        msgString errorPrintCR.
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  4390
        thisContext fullPrintAll.
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  4391
        OperatingSystem exit:1
5755
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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4394
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4395
     find an appropriate debugger to use
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4396
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4397
    debugger := self appropriateDebugger:(thisContext selector).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4398
    debugger isNil ifTrue:[
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  4399
        ^ AbortOperationRequest raiseRequest
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  4400
    ].
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  4401
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  4402
    ^ debugger
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  4403
        enter:ex returnableSuspendedContext
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  4404
        withMessage:ex descriptionForDebugger
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  4405
        mayProceed:(ex mayProceed).
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4406
13849
01e27cdbf2bb changed: #openDebuggerOnException:
Claus Gittinger <cg@exept.de>
parents: 13848
diff changeset
  4407
    "Modified: / 05-12-2011 / 11:53:10 / cg"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4408
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4409
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4410
primitiveFailed
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4411
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4412
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4413
    "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
  4414
     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
  4415
11021
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4416
    <resource: #skipInDebuggersWalkBack>
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4417
8324
c6e8039f0d83 Set message as parameter in #primitiveFailed
Stefan Vogel <sv@exept.de>
parents: 8322
diff changeset
  4418
    |sender|
c6e8039f0d83 Set message as parameter in #primitiveFailed
Stefan Vogel <sv@exept.de>
parents: 8322
diff changeset
  4419
c6e8039f0d83 Set message as parameter in #primitiveFailed
Stefan Vogel <sv@exept.de>
parents: 8322
diff changeset
  4420
    sender := thisContext sender.
c6e8039f0d83 Set message as parameter in #primitiveFailed
Stefan Vogel <sv@exept.de>
parents: 8322
diff changeset
  4421
c6e8039f0d83 Set message as parameter in #primitiveFailed
Stefan Vogel <sv@exept.de>
parents: 8322
diff changeset
  4422
    ^ PrimitiveFailure raiseRequestWith:(Message selector:sender selector arguments:sender args)
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  4423
                       in:sender.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4424
6005
012813d02bf7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6000
diff changeset
  4425
    "
012813d02bf7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6000
diff changeset
  4426
     1234 primitiveFailed
8324
c6e8039f0d83 Set message as parameter in #primitiveFailed
Stefan Vogel <sv@exept.de>
parents: 8322
diff changeset
  4427
c6e8039f0d83 Set message as parameter in #primitiveFailed
Stefan Vogel <sv@exept.de>
parents: 8322
diff changeset
  4428
     [
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  4429
        ExternalBytes new   basicAt:40
8324
c6e8039f0d83 Set message as parameter in #primitiveFailed
Stefan Vogel <sv@exept.de>
parents: 8322
diff changeset
  4430
     ] on:PrimitiveFailure do:[:ex|
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  4431
        ex inspect
8324
c6e8039f0d83 Set message as parameter in #primitiveFailed
Stefan Vogel <sv@exept.de>
parents: 8322
diff changeset
  4432
     ]
c6e8039f0d83 Set message as parameter in #primitiveFailed
Stefan Vogel <sv@exept.de>
parents: 8322
diff changeset
  4433
    "
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4434
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4435
8977
fff5644c031d #primitiveFailed: remember the message implementing the failure
Stefan Vogel <sv@exept.de>
parents: 8975
diff changeset
  4436
primitiveFailed:messageString
fff5644c031d #primitiveFailed: remember the message implementing the failure
Stefan Vogel <sv@exept.de>
parents: 8975
diff changeset
  4437
    "{ Pragma: +optSpace }"
fff5644c031d #primitiveFailed: remember the message implementing the failure
Stefan Vogel <sv@exept.de>
parents: 8975
diff changeset
  4438
fff5644c031d #primitiveFailed: remember the message implementing the failure
Stefan Vogel <sv@exept.de>
parents: 8975
diff changeset
  4439
    "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
  4440
     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
  4441
11021
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4442
    <resource: #skipInDebuggersWalkBack>
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4443
8977
fff5644c031d #primitiveFailed: remember the message implementing the failure
Stefan Vogel <sv@exept.de>
parents: 8975
diff changeset
  4444
    |sender|
fff5644c031d #primitiveFailed: remember the message implementing the failure
Stefan Vogel <sv@exept.de>
parents: 8975
diff changeset
  4445
fff5644c031d #primitiveFailed: remember the message implementing the failure
Stefan Vogel <sv@exept.de>
parents: 8975
diff changeset
  4446
    sender := thisContext sender.
fff5644c031d #primitiveFailed: remember the message implementing the failure
Stefan Vogel <sv@exept.de>
parents: 8975
diff changeset
  4447
fff5644c031d #primitiveFailed: remember the message implementing the failure
Stefan Vogel <sv@exept.de>
parents: 8975
diff changeset
  4448
    ^ PrimitiveFailure raiseRequestWith:(Message selector:sender selector arguments:sender args)
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  4449
                       errorString:messageString
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  4450
                       in:sender.
8977
fff5644c031d #primitiveFailed: remember the message implementing the failure
Stefan Vogel <sv@exept.de>
parents: 8975
diff changeset
  4451
fff5644c031d #primitiveFailed: remember the message implementing the failure
Stefan Vogel <sv@exept.de>
parents: 8975
diff changeset
  4452
    "
fff5644c031d #primitiveFailed: remember the message implementing the failure
Stefan Vogel <sv@exept.de>
parents: 8975
diff changeset
  4453
     1234 primitiveFailed:'this is a test'
fff5644c031d #primitiveFailed: remember the message implementing the failure
Stefan Vogel <sv@exept.de>
parents: 8975
diff changeset
  4454
    "
fff5644c031d #primitiveFailed: remember the message implementing the failure
Stefan Vogel <sv@exept.de>
parents: 8975
diff changeset
  4455
!
fff5644c031d #primitiveFailed: remember the message implementing the failure
Stefan Vogel <sv@exept.de>
parents: 8975
diff changeset
  4456
6815
71582d439a74 Define #shouldImplement
Stefan Vogel <sv@exept.de>
parents: 6805
diff changeset
  4457
shouldImplement
71582d439a74 Define #shouldImplement
Stefan Vogel <sv@exept.de>
parents: 6805
diff changeset
  4458
    "{ Pragma: +optSpace }"
71582d439a74 Define #shouldImplement
Stefan Vogel <sv@exept.de>
parents: 6805
diff changeset
  4459
12321
ff74d7eab313 added: #shouldImplement:
Claus Gittinger <cg@exept.de>
parents: 12288
diff changeset
  4460
    "report an error that this message/functionality should be implemented.
ff74d7eab313 added: #shouldImplement:
Claus Gittinger <cg@exept.de>
parents: 12288
diff changeset
  4461
     This is send by automatically generated method bodies or inside as-yet-uncoded
ff74d7eab313 added: #shouldImplement:
Claus Gittinger <cg@exept.de>
parents: 12288
diff changeset
  4462
     branches of existing methods."
6815
71582d439a74 Define #shouldImplement
Stefan Vogel <sv@exept.de>
parents: 6805
diff changeset
  4463
11021
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4464
    <resource: #skipInDebuggersWalkBack>
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4465
9216
6396192d71c6 use UnimplementedFunctionalityError in #subclassResponsibility
Stefan Vogel <sv@exept.de>
parents: 9203
diff changeset
  4466
    |sender|
6396192d71c6 use UnimplementedFunctionalityError in #subclassResponsibility
Stefan Vogel <sv@exept.de>
parents: 9203
diff changeset
  4467
6396192d71c6 use UnimplementedFunctionalityError in #subclassResponsibility
Stefan Vogel <sv@exept.de>
parents: 9203
diff changeset
  4468
    sender := thisContext sender.
6396192d71c6 use UnimplementedFunctionalityError in #subclassResponsibility
Stefan Vogel <sv@exept.de>
parents: 9203
diff changeset
  4469
12841
d804b0f27fe7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12733
diff changeset
  4470
    ^ UnimplementedFunctionalityError
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  4471
        raiseRequestWith:(Message selector:sender selector arguments:sender args)
9216
6396192d71c6 use UnimplementedFunctionalityError in #subclassResponsibility
Stefan Vogel <sv@exept.de>
parents: 9203
diff changeset
  4472
6396192d71c6 use UnimplementedFunctionalityError in #subclassResponsibility
Stefan Vogel <sv@exept.de>
parents: 9203
diff changeset
  4473
     "
12321
ff74d7eab313 added: #shouldImplement:
Claus Gittinger <cg@exept.de>
parents: 12288
diff changeset
  4474
      self shouldImplement
ff74d7eab313 added: #shouldImplement:
Claus Gittinger <cg@exept.de>
parents: 12288
diff changeset
  4475
     "
ff74d7eab313 added: #shouldImplement:
Claus Gittinger <cg@exept.de>
parents: 12288
diff changeset
  4476
!
ff74d7eab313 added: #shouldImplement:
Claus Gittinger <cg@exept.de>
parents: 12288
diff changeset
  4477
ff74d7eab313 added: #shouldImplement:
Claus Gittinger <cg@exept.de>
parents: 12288
diff changeset
  4478
shouldImplement:what
ff74d7eab313 added: #shouldImplement:
Claus Gittinger <cg@exept.de>
parents: 12288
diff changeset
  4479
    "{ Pragma: +optSpace }"
ff74d7eab313 added: #shouldImplement:
Claus Gittinger <cg@exept.de>
parents: 12288
diff changeset
  4480
ff74d7eab313 added: #shouldImplement:
Claus Gittinger <cg@exept.de>
parents: 12288
diff changeset
  4481
    "report an error that this message/functionality should be implemented.
ff74d7eab313 added: #shouldImplement:
Claus Gittinger <cg@exept.de>
parents: 12288
diff changeset
  4482
     This is send by automatically generated method bodies or inside as-yet-uncoded
ff74d7eab313 added: #shouldImplement:
Claus Gittinger <cg@exept.de>
parents: 12288
diff changeset
  4483
     branches of existing methods."
ff74d7eab313 added: #shouldImplement:
Claus Gittinger <cg@exept.de>
parents: 12288
diff changeset
  4484
ff74d7eab313 added: #shouldImplement:
Claus Gittinger <cg@exept.de>
parents: 12288
diff changeset
  4485
    <resource: #skipInDebuggersWalkBack>
ff74d7eab313 added: #shouldImplement:
Claus Gittinger <cg@exept.de>
parents: 12288
diff changeset
  4486
ff74d7eab313 added: #shouldImplement:
Claus Gittinger <cg@exept.de>
parents: 12288
diff changeset
  4487
    |sender|
ff74d7eab313 added: #shouldImplement:
Claus Gittinger <cg@exept.de>
parents: 12288
diff changeset
  4488
ff74d7eab313 added: #shouldImplement:
Claus Gittinger <cg@exept.de>
parents: 12288
diff changeset
  4489
    sender := thisContext sender.
ff74d7eab313 added: #shouldImplement:
Claus Gittinger <cg@exept.de>
parents: 12288
diff changeset
  4490
12841
d804b0f27fe7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12733
diff changeset
  4491
    ^ UnimplementedFunctionalityError
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  4492
        raiseRequestWith:(Message selector:sender selector arguments:sender args)
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  4493
        errorString:what
12321
ff74d7eab313 added: #shouldImplement:
Claus Gittinger <cg@exept.de>
parents: 12288
diff changeset
  4494
ff74d7eab313 added: #shouldImplement:
Claus Gittinger <cg@exept.de>
parents: 12288
diff changeset
  4495
     "
ff74d7eab313 added: #shouldImplement:
Claus Gittinger <cg@exept.de>
parents: 12288
diff changeset
  4496
      self shouldImplement:'foobar'
9216
6396192d71c6 use UnimplementedFunctionalityError in #subclassResponsibility
Stefan Vogel <sv@exept.de>
parents: 9203
diff changeset
  4497
     "
6815
71582d439a74 Define #shouldImplement
Stefan Vogel <sv@exept.de>
parents: 6805
diff changeset
  4498
!
71582d439a74 Define #shouldImplement
Stefan Vogel <sv@exept.de>
parents: 6805
diff changeset
  4499
11976
2c8e5e4f97f4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11790
diff changeset
  4500
shouldNeverBeReached
12321
ff74d7eab313 added: #shouldImplement:
Claus Gittinger <cg@exept.de>
parents: 12288
diff changeset
  4501
    "report an error that this point may never be reached."
12841
d804b0f27fe7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12733
diff changeset
  4502
14499
6ed948158d25 class: Object
Claus Gittinger <cg@exept.de>
parents: 14478
diff changeset
  4503
    <resource: #skipInDebuggersWalkBack>
6ed948158d25 class: Object
Claus Gittinger <cg@exept.de>
parents: 14478
diff changeset
  4504
6ed948158d25 class: Object
Claus Gittinger <cg@exept.de>
parents: 14478
diff changeset
  4505
    ^ ExecutionError
6ed948158d25 class: Object
Claus Gittinger <cg@exept.de>
parents: 14478
diff changeset
  4506
        raiseRequestErrorString:'Oops, this may never reached. Something somewhere was terribly wrong.'.
11976
2c8e5e4f97f4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11790
diff changeset
  4507
2c8e5e4f97f4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11790
diff changeset
  4508
    "Modified: / 20-04-2005 / 18:59:28 / janfrog"
2c8e5e4f97f4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11790
diff changeset
  4509
!
2c8e5e4f97f4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11790
diff changeset
  4510
2c8e5e4f97f4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11790
diff changeset
  4511
shouldNeverBeSent
12321
ff74d7eab313 added: #shouldImplement:
Claus Gittinger <cg@exept.de>
parents: 12288
diff changeset
  4512
    "report an error that this message may never be sent to the reciever"
12841
d804b0f27fe7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12733
diff changeset
  4513
14499
6ed948158d25 class: Object
Claus Gittinger <cg@exept.de>
parents: 14478
diff changeset
  4514
    <resource: #skipInDebuggersWalkBack>
6ed948158d25 class: Object
Claus Gittinger <cg@exept.de>
parents: 14478
diff changeset
  4515
14478
4ff5aab56d26 more specific error reporting for type errors
Claus Gittinger <cg@exept.de>
parents: 14369
diff changeset
  4516
    "/ ^ self error:'This message never may be sent to me!!'.
4ff5aab56d26 more specific error reporting for type errors
Claus Gittinger <cg@exept.de>
parents: 14369
diff changeset
  4517
    ^ MethodNotAppropriateError 
4ff5aab56d26 more specific error reporting for type errors
Claus Gittinger <cg@exept.de>
parents: 14369
diff changeset
  4518
        raiseRequestErrorString:'This message never may be sent to me!!'
11976
2c8e5e4f97f4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11790
diff changeset
  4519
2c8e5e4f97f4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11790
diff changeset
  4520
    "Modified: / 20-04-2005 / 18:59:28 / janfrog"
14478
4ff5aab56d26 more specific error reporting for type errors
Claus Gittinger <cg@exept.de>
parents: 14369
diff changeset
  4521
    "Modified: / 02-11-2012 / 10:10:42 / cg"
11976
2c8e5e4f97f4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11790
diff changeset
  4522
!
2c8e5e4f97f4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11790
diff changeset
  4523
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4524
shouldNotImplement
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4525
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4526
12841
d804b0f27fe7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12733
diff changeset
  4527
    "report an error that this message should not be implemented -
12733
48cc66ac5d52 comment/format in: #shouldNotImplement
Claus Gittinger <cg@exept.de>
parents: 12718
diff changeset
  4528
     i.e. that a method is invoked which is not appropriate for the receiver."
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4529
11021
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4530
    <resource: #skipInDebuggersWalkBack>
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4531
14478
4ff5aab56d26 more specific error reporting for type errors
Claus Gittinger <cg@exept.de>
parents: 14369
diff changeset
  4532
    "/ self error:'method/functionality not appropriate for this class'
4ff5aab56d26 more specific error reporting for type errors
Claus Gittinger <cg@exept.de>
parents: 14369
diff changeset
  4533
    ^ MethodNotAppropriateError 
4ff5aab56d26 more specific error reporting for type errors
Claus Gittinger <cg@exept.de>
parents: 14369
diff changeset
  4534
        raiseRequestErrorString:'method/functionality not appropriate for this class'
4ff5aab56d26 more specific error reporting for type errors
Claus Gittinger <cg@exept.de>
parents: 14369
diff changeset
  4535
4ff5aab56d26 more specific error reporting for type errors
Claus Gittinger <cg@exept.de>
parents: 14369
diff changeset
  4536
    "Modified: / 02-11-2012 / 10:02:25 / cg"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4537
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4538
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4539
subclassResponsibility
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4540
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4541
12321
ff74d7eab313 added: #shouldImplement:
Claus Gittinger <cg@exept.de>
parents: 12288
diff changeset
  4542
    "report an error that this message should have been reimplemented in a subclass"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4543
11021
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4544
    <resource: #skipInDebuggersWalkBack>
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4545
10877
0666d48f91d1 show the affected method-selector in the subclassResponsibility
Claus Gittinger <cg@exept.de>
parents: 10856
diff changeset
  4546
    ^ SubclassResponsibilityError raiseRequestWith:thisContext sender selector
5755
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
6721
e5f47c6e2f40 #subclassResponsibility & #subclassResponsibility:
Claus Gittinger <cg@exept.de>
parents: 6718
diff changeset
  4549
subclassResponsibility:msg
e5f47c6e2f40 #subclassResponsibility & #subclassResponsibility:
Claus Gittinger <cg@exept.de>
parents: 6718
diff changeset
  4550
    "{ Pragma: +optSpace }"
e5f47c6e2f40 #subclassResponsibility & #subclassResponsibility:
Claus Gittinger <cg@exept.de>
parents: 6718
diff changeset
  4551
e5f47c6e2f40 #subclassResponsibility & #subclassResponsibility:
Claus Gittinger <cg@exept.de>
parents: 6718
diff changeset
  4552
    "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
  4553
11021
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4554
    <resource: #skipInDebuggersWalkBack>
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4555
7334
7da368a2f0da *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 7322
diff changeset
  4556
    ^ SubclassResponsibilityError raiseRequestErrorString:msg
6721
e5f47c6e2f40 #subclassResponsibility & #subclassResponsibility:
Claus Gittinger <cg@exept.de>
parents: 6718
diff changeset
  4557
!
e5f47c6e2f40 #subclassResponsibility & #subclassResponsibility:
Claus Gittinger <cg@exept.de>
parents: 6718
diff changeset
  4558
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4559
subscriptBoundsError
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
    "report an error that some index is out of bounds.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4563
     (when accessing indexable collections).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4564
     The error is reported by raising the SubscriptOutOfBoundsSignal exception."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4565
11021
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4566
    <resource: #skipInDebuggersWalkBack>
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4567
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4568
    ^ SubscriptOutOfBoundsSignal raiseRequestWith:nil
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4569
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4570
    "Modified: / 26.7.1996 / 16:45:42 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4571
    "Modified: / 26.7.1999 / 10:58:27 / stefan"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4572
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4573
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4574
subscriptBoundsError:anIndex
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4575
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4576
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4577
    "report an error that anIndex is out of bounds.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4578
     (when accessing indexable collections).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4579
     The error is reported by raising the SubscriptOutOfBoundsSignal exception."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4580
11021
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4581
    <resource: #skipInDebuggersWalkBack>
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4582
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  4583
    ^ SubscriptOutOfBoundsError
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  4584
        raiseRequestWith:anIndex
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  4585
        errorString:('subscript (' , anIndex printString , ') out of bounds')
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4586
6221
404495587300 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6203
diff changeset
  4587
    "Modified: / 17.11.2001 / 22:49:56 / cg"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4588
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4589
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4590
typeCheckError
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4591
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4592
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4593
    "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
  4594
     value assigned"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4595
11021
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4596
    <resource: #skipInDebuggersWalkBack>
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4597
14478
4ff5aab56d26 more specific error reporting for type errors
Claus Gittinger <cg@exept.de>
parents: 14369
diff changeset
  4598
"/    ^ self error:'bad assign of ' , self printString ,
4ff5aab56d26 more specific error reporting for type errors
Claus Gittinger <cg@exept.de>
parents: 14369
diff changeset
  4599
"/                  ' (' , self class name , ') to typed variable'
4ff5aab56d26 more specific error reporting for type errors
Claus Gittinger <cg@exept.de>
parents: 14369
diff changeset
  4600
4ff5aab56d26 more specific error reporting for type errors
Claus Gittinger <cg@exept.de>
parents: 14369
diff changeset
  4601
    ^ InvalidTypeError
4ff5aab56d26 more specific error reporting for type errors
Claus Gittinger <cg@exept.de>
parents: 14369
diff changeset
  4602
        raiseRequestErrorString:
4ff5aab56d26 more specific error reporting for type errors
Claus Gittinger <cg@exept.de>
parents: 14369
diff changeset
  4603
            ('bad assign of ' , self printString ,
4ff5aab56d26 more specific error reporting for type errors
Claus Gittinger <cg@exept.de>
parents: 14369
diff changeset
  4604
                  ' (' , self class name , ') to typed variable')
4ff5aab56d26 more specific error reporting for type errors
Claus Gittinger <cg@exept.de>
parents: 14369
diff changeset
  4605
4ff5aab56d26 more specific error reporting for type errors
Claus Gittinger <cg@exept.de>
parents: 14369
diff changeset
  4606
    "Modified: / 02-11-2012 / 10:19:15 / cg"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4607
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4608
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4609
!Object methodsFor:'evaluation'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4610
8690
5894d98a4a61 Implement #argumentCount for Block-compatibility.
Stefan Vogel <sv@exept.de>
parents: 8637
diff changeset
  4611
argumentCount
5894d98a4a61 Implement #argumentCount for Block-compatibility.
Stefan Vogel <sv@exept.de>
parents: 8637
diff changeset
  4612
    "compatibility with Blocks and Messages.
5894d98a4a61 Implement #argumentCount for Block-compatibility.
Stefan Vogel <sv@exept.de>
parents: 8637
diff changeset
  4613
     Answer 0, since we only understand #value.
5894d98a4a61 Implement #argumentCount for Block-compatibility.
Stefan Vogel <sv@exept.de>
parents: 8637
diff changeset
  4614
5894d98a4a61 Implement #argumentCount for Block-compatibility.
Stefan Vogel <sv@exept.de>
parents: 8637
diff changeset
  4615
     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
  4616
5894d98a4a61 Implement #argumentCount for Block-compatibility.
Stefan Vogel <sv@exept.de>
parents: 8637
diff changeset
  4617
    ^ 0
5894d98a4a61 Implement #argumentCount for Block-compatibility.
Stefan Vogel <sv@exept.de>
parents: 8637
diff changeset
  4618
5894d98a4a61 Implement #argumentCount for Block-compatibility.
Stefan Vogel <sv@exept.de>
parents: 8637
diff changeset
  4619
    "
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  4620
        [1 // 0] on:ArithmeticError do:9999
8690
5894d98a4a61 Implement #argumentCount for Block-compatibility.
Stefan Vogel <sv@exept.de>
parents: 8637
diff changeset
  4621
    "
5894d98a4a61 Implement #argumentCount for Block-compatibility.
Stefan Vogel <sv@exept.de>
parents: 8637
diff changeset
  4622
!
5894d98a4a61 Implement #argumentCount for Block-compatibility.
Stefan Vogel <sv@exept.de>
parents: 8637
diff changeset
  4623
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4624
value
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4625
    "return the receiver itself.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4626
     This allows every object to be used where blocks or valueHolders
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4627
     are typically used, and allows for valueHolders and blocks to be
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4628
     used interchangably in some situations.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4629
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4630
     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
  4631
     style ... (the idea was borrowed from the Self language).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4632
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  4633
     WARNING: dont 'optimize' away ifXXX: blocks
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  4634
              (i.e. do NOT replace
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  4635
                        foo ifTrue:[var1] ifFalse:[var2]
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  4636
               by:
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  4637
                        foo ifTrue:var1 ifFalse:var2
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  4638
              )
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  4639
              - the compilers will only generate inline code for the if,
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  4640
                iff the argument(s) are blocks - otherwise, a true send is
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  4641
                generated.
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  4642
              This 'oprimization' will work semantically correct,
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  4643
              but execute SLOWER instead."
5755
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
    ^ self
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4646
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4647
    "
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  4648
     #(1 2 3 4) indexOf:5 ifAbsent:0
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  4649
     #(1 2 3 4) indexOf:5 ifAbsent:[0]
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  4650
     1 > 2 ifTrue:['yes'] ifFalse:['no']
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  4651
     1 > 2 ifTrue:'yes' ifFalse:'no'
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4652
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4653
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4654
    "DO NOT DO THIS (its slower)
7458
b0ca7546cbd6 CG: comment in value
Stefan Vogel <sv@exept.de>
parents: 7455
diff changeset
  4655
     (1 > 4) ifTrue:a ifFalse:b
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
     USE (the compiler optimizes blocks in if/while):
7458
b0ca7546cbd6 CG: comment in value
Stefan Vogel <sv@exept.de>
parents: 7455
diff changeset
  4658
     (1 > 4) ifTrue:[a] ifFalse:[b]
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4659
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4660
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4661
    "Modified: 3.5.1996 / 11:57:08 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4662
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4663
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4664
!Object methodsFor:'finalization'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4665
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4666
disposed
6439
0f841258ec4a Use #finalize instead of #disposed
Stefan Vogel <sv@exept.de>
parents: 6421
diff changeset
  4667
    "OBSOLETE INTERFACE: use #finalize
0f841258ec4a Use #finalize instead of #disposed
Stefan Vogel <sv@exept.de>
parents: 6421
diff changeset
  4668
     this is invoked for objects which have been registered
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4669
     in a Registry, when the original object dies.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4670
     Subclasses may redefine this method"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4671
6439
0f841258ec4a Use #finalize instead of #disposed
Stefan Vogel <sv@exept.de>
parents: 6421
diff changeset
  4672
    <resource: #obsolete>
0f841258ec4a Use #finalize instead of #disposed
Stefan Vogel <sv@exept.de>
parents: 6421
diff changeset
  4673
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4674
    ^ self
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4675
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4676
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4677
executor
6439
0f841258ec4a Use #finalize instead of #disposed
Stefan Vogel <sv@exept.de>
parents: 6421
diff changeset
  4678
    "Return the object which does the finalization for me.
0f841258ec4a Use #finalize instead of #disposed
Stefan Vogel <sv@exept.de>
parents: 6421
diff changeset
  4679
     This interface is also VW & Sqeak compatible,"
0f841258ec4a Use #finalize instead of #disposed
Stefan Vogel <sv@exept.de>
parents: 6421
diff changeset
  4680
0f841258ec4a Use #finalize instead of #disposed
Stefan Vogel <sv@exept.de>
parents: 6421
diff changeset
  4681
    "for now, send #shallowCopyForFinalization, to be compatible with
0f841258ec4a Use #finalize instead of #disposed
Stefan Vogel <sv@exept.de>
parents: 6421
diff changeset
  4682
     classes designed for old ST/X versions"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4683
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4684
    ^ self shallowCopyForFinalization
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4685
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4686
6461
f5efaff3457b Allow #registerForFinalization for classes defining their own Lobby.
Stefan Vogel <sv@exept.de>
parents: 6439
diff changeset
  4687
finalizationLobby
f5efaff3457b Allow #registerForFinalization for classes defining their own Lobby.
Stefan Vogel <sv@exept.de>
parents: 6439
diff changeset
  4688
    "answer a Registry used for finalization.
f5efaff3457b Allow #registerForFinalization for classes defining their own Lobby.
Stefan Vogel <sv@exept.de>
parents: 6439
diff changeset
  4689
     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
  4690
     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
  4691
f5efaff3457b Allow #registerForFinalization for classes defining their own Lobby.
Stefan Vogel <sv@exept.de>
parents: 6439
diff changeset
  4692
    ^ FinalizationLobby
f5efaff3457b Allow #registerForFinalization for classes defining their own Lobby.
Stefan Vogel <sv@exept.de>
parents: 6439
diff changeset
  4693
!
f5efaff3457b Allow #registerForFinalization for classes defining their own Lobby.
Stefan Vogel <sv@exept.de>
parents: 6439
diff changeset
  4694
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4695
finalize
6439
0f841258ec4a Use #finalize instead of #disposed
Stefan Vogel <sv@exept.de>
parents: 6421
diff changeset
  4696
    "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
  4697
     in a Registry, when the original object dies.
0f841258ec4a Use #finalize instead of #disposed
Stefan Vogel <sv@exept.de>
parents: 6421
diff changeset
  4698
     Subclasses may redefine this method
0f841258ec4a Use #finalize instead of #disposed
Stefan Vogel <sv@exept.de>
parents: 6421
diff changeset
  4699
     This interface is also VW-compatible"
0f841258ec4a Use #finalize instead of #disposed
Stefan Vogel <sv@exept.de>
parents: 6421
diff changeset
  4700
0f841258ec4a Use #finalize instead of #disposed
Stefan Vogel <sv@exept.de>
parents: 6421
diff changeset
  4701
    "send #disposed for compatibility with existing classes that still
0f841258ec4a Use #finalize instead of #disposed
Stefan Vogel <sv@exept.de>
parents: 6421
diff changeset
  4702
     implement the obsolete #disposed message"
0f841258ec4a Use #finalize instead of #disposed
Stefan Vogel <sv@exept.de>
parents: 6421
diff changeset
  4703
0f841258ec4a Use #finalize instead of #disposed
Stefan Vogel <sv@exept.de>
parents: 6421
diff changeset
  4704
    ^ self disposed
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4705
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4706
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4707
reRegisterForFinalization
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4708
    "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
  4709
     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
  4710
     the receiver is garbage collected."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4711
6461
f5efaff3457b Allow #registerForFinalization for classes defining their own Lobby.
Stefan Vogel <sv@exept.de>
parents: 6439
diff changeset
  4712
    self finalizationLobby registerChange:self
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4713
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4714
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4715
registerForFinalization
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4716
    "register mySelf for later finalization.
6461
f5efaff3457b Allow #registerForFinalization for classes defining their own Lobby.
Stefan Vogel <sv@exept.de>
parents: 6439
diff changeset
  4717
     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
  4718
     the receiver is garbage collected."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4719
6461
f5efaff3457b Allow #registerForFinalization for classes defining their own Lobby.
Stefan Vogel <sv@exept.de>
parents: 6439
diff changeset
  4720
    self finalizationLobby register:self
f5efaff3457b Allow #registerForFinalization for classes defining their own Lobby.
Stefan Vogel <sv@exept.de>
parents: 6439
diff changeset
  4721
!
f5efaff3457b Allow #registerForFinalization for classes defining their own Lobby.
Stefan Vogel <sv@exept.de>
parents: 6439
diff changeset
  4722
f5efaff3457b Allow #registerForFinalization for classes defining their own Lobby.
Stefan Vogel <sv@exept.de>
parents: 6439
diff changeset
  4723
shallowCopyForFinalization
f5efaff3457b Allow #registerForFinalization for classes defining their own Lobby.
Stefan Vogel <sv@exept.de>
parents: 6439
diff changeset
  4724
    "OBSOLETE INTERFACE: use #executor.
f5efaff3457b Allow #registerForFinalization for classes defining their own Lobby.
Stefan Vogel <sv@exept.de>
parents: 6439
diff changeset
  4725
     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
  4726
     (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
  4727
     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
  4728
f5efaff3457b Allow #registerForFinalization for classes defining their own Lobby.
Stefan Vogel <sv@exept.de>
parents: 6439
diff changeset
  4729
    <resource: #obsolete>
f5efaff3457b Allow #registerForFinalization for classes defining their own Lobby.
Stefan Vogel <sv@exept.de>
parents: 6439
diff changeset
  4730
f5efaff3457b Allow #registerForFinalization for classes defining their own Lobby.
Stefan Vogel <sv@exept.de>
parents: 6439
diff changeset
  4731
    ^ self shallowCopy
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4732
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4733
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4734
unregisterForFinalization
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4735
    "unregister mySelf from later finalization"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4736
6461
f5efaff3457b Allow #registerForFinalization for classes defining their own Lobby.
Stefan Vogel <sv@exept.de>
parents: 6439
diff changeset
  4737
    self finalizationLobby unregister:self
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4738
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4739
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4740
!Object methodsFor:'initialization'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4741
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4742
initialize
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4743
    "just to ignore initialize to objects which do not need it"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4744
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4745
    ^ self
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4746
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4747
13190
1e2813b585c9 category of: #inspectorClass
Claus Gittinger <cg@exept.de>
parents: 13187
diff changeset
  4748
!Object methodsFor:'inspecting'!
1e2813b585c9 category of: #inspectorClass
Claus Gittinger <cg@exept.de>
parents: 13187
diff changeset
  4749
1e2813b585c9 category of: #inspectorClass
Claus Gittinger <cg@exept.de>
parents: 13187
diff changeset
  4750
inspectorClass
1e2813b585c9 category of: #inspectorClass
Claus Gittinger <cg@exept.de>
parents: 13187
diff changeset
  4751
    "{ Pragma: +optSpace }"
1e2813b585c9 category of: #inspectorClass
Claus Gittinger <cg@exept.de>
parents: 13187
diff changeset
  4752
1e2813b585c9 category of: #inspectorClass
Claus Gittinger <cg@exept.de>
parents: 13187
diff changeset
  4753
    "return the class to use for inspect.
1e2813b585c9 category of: #inspectorClass
Claus Gittinger <cg@exept.de>
parents: 13187
diff changeset
  4754
     Can (should) be redefined in classes for which a better inspector is available"
1e2813b585c9 category of: #inspectorClass
Claus Gittinger <cg@exept.de>
parents: 13187
diff changeset
  4755
14055
b9292728b602 changed: #inspectorClass
Claus Gittinger <cg@exept.de>
parents: 14046
diff changeset
  4756
    ^ Inspector ? InspectorView
b9292728b602 changed: #inspectorClass
Claus Gittinger <cg@exept.de>
parents: 14046
diff changeset
  4757
b9292728b602 changed: #inspectorClass
Claus Gittinger <cg@exept.de>
parents: 14046
diff changeset
  4758
    "Modified: / 08-03-2012 / 16:09:38 / cg"
13190
1e2813b585c9 category of: #inspectorClass
Claus Gittinger <cg@exept.de>
parents: 13187
diff changeset
  4759
! !
1e2813b585c9 category of: #inspectorClass
Claus Gittinger <cg@exept.de>
parents: 13187
diff changeset
  4760
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4761
!Object methodsFor:'interrupt handling'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4762
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4763
childSignalInterrupt
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4764
    "death of a child process (unix process) - do nothing"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4765
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4766
    ^ self
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4767
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4768
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4769
customInterrupt
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4770
    "{ Pragma: +optSpace }"
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
    "a custom interrupt - but no handler has defined"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4773
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4774
    self error:'custom interrupt' mayProceed:true
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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4777
errorInterrupt:errorID with:aParameter
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4778
    "subsystem error. The arguments errorID and aParameter are the values passed
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  4779
     to the 'errorInterruptWithIDAndParameter(id, param)' function,
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4780
     which can be called from C subsystems to raise an (asynchronous)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4781
     error exception.
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
     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
  4784
     used from other C subsystems too, to upcast errors.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4785
     Especially, for subsystems which call errorHandler functions asynchronously.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4786
     IDs (currently) used:
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  4787
        #DisplayError ..... x-error interrupt
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  4788
        #XtError      ..... xt-error interrupt (Xt interface is not yet published)
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4789
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4790
6263
4e7a970e4cfc errorInterrupt:with: fixed (care for nil handlers in Objmem)
Claus Gittinger <cg@exept.de>
parents: 6235
diff changeset
  4791
    |handlers handler|
4e7a970e4cfc errorInterrupt:with: fixed (care for nil handlers in Objmem)
Claus Gittinger <cg@exept.de>
parents: 6235
diff changeset
  4792
4e7a970e4cfc errorInterrupt:with: fixed (care for nil handlers in Objmem)
Claus Gittinger <cg@exept.de>
parents: 6235
diff changeset
  4793
    handlers := ObjectMemory registeredErrorInterruptHandlers.
4e7a970e4cfc errorInterrupt:with: fixed (care for nil handlers in Objmem)
Claus Gittinger <cg@exept.de>
parents: 6235
diff changeset
  4794
    handlers notNil ifTrue:[
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  4795
        handler := handlers at:errorID ifAbsent:nil.
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  4796
        handler notNil ifTrue:[
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  4797
            "/
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  4798
            "/ handler found; let it do whatever it wants ...
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  4799
            "/
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  4800
            handler errorInterrupt:errorID with:aParameter.
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  4801
            ^ self
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  4802
        ].
5755
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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4805
    "/
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4806
    "/ no handler - raise errorSignal passing the errorId as parameter
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4807
    "/
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  4808
    ^ Error
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  4809
        raiseRequestWith:errorID
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  4810
        errorString:('Subsystem error. ErrorID = ' , errorID printString)
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4811
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4812
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4813
exceptionInterrupt
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4814
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4815
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4816
    "exception interrupt - enter debugger"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4817
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4818
    self error:'exception Interrupt' mayProceed:true
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4819
!
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
fpExceptionInterrupt
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4822
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4823
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4824
    "a floating point exception occured - this one
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4825
     has to be handled differently since it comes asynchronous
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4826
     on some machines (for example, on machines with a separate FPU
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4827
     or superscalar architectures. Also, errors from within primitive code
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4828
     (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
  4829
     mechanism this way."
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
    |where rec|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4832
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4833
    where := thisContext sender.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4834
    rec := where receiver.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4835
    rec isNumber ifTrue:[
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  4836
        ^ rec class
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  4837
            raise:#domainErrorSignal
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  4838
            receiver:rec
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  4839
            selector:where selector
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  4840
            arguments:(where args asArray)
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  4841
            errorString:'floating point exception'
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4842
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4843
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4844
    "/ could be in some C-library ...
7402
b9d45ce2463a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7359
diff changeset
  4845
    ^ DomainError raise
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4846
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4847
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4848
internalError:msg
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4849
    "{ Pragma: +optSpace }"
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
    "this is triggered, when VM hits some bad error,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4852
     such as corrupted class, corrupted method/selector array
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4853
     etc. The argument string gives some more information on what happened.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4854
     (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
  4855
     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
  4856
     this error occurred ...."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4857
8330
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
  4858
    VMInternalError raiseWith:self errorString:msg
5755
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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4861
ioInterrupt
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4862
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4863
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4864
    "I/O (SIGIO/SIGPOLL) interrupt (supposed to be sent to Processor).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4865
     If we arrive here, there is either no handler (ObjMem>>ioInterruptHandler)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4866
     or it does not understand the ioInterrupt message.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4867
     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
  4868
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4869
    self error:'I/O Interrupt - but no handler' mayProceed:true
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4870
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4871
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4872
memoryInterrupt
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4873
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4874
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4875
    "out-of-memory interrupt and no handler - enter debugger"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4876
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4877
    self error:'almost out of memory' mayProceed:true
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4878
!
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
recursionInterrupt
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4881
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4882
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4883
    "recursion limit (actually: stack overflow) interrupt.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4884
     This interrupt is triggered, when a process stack grows above
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4885
     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
  4886
     could be caught.
e9970db3e02f recursionInterrupt fixes for win32 (& comment changed)
Claus Gittinger <cg@exept.de>
parents: 6157
diff changeset
  4887
     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
  4888
     and the exception can be resumed.
e9970db3e02f recursionInterrupt fixes for win32 (& comment changed)
Claus Gittinger <cg@exept.de>
parents: 6157
diff changeset
  4889
     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
  4890
     is not proceedable.
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  4891
     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
  4892
     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
  4893
     or debug for a while.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4894
     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
  4895
     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
  4896
     terminates the process."
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4897
7838
4cf3d0dad430 skip recursive contexts when shwing backtrace of recursionInterrupt
Claus Gittinger <cg@exept.de>
parents: 7685
diff changeset
  4898
    |con remaining sender nSkipped|
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4899
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4900
    (con := thisContext) isRecursive ifFalse:[
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4901
"/        Processor activeProcess usedStackSize < Processor activeProcess maximumStackSize ifTrue:[
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4902
"/            "/ mhmh - it hit me, but I am not responsible ...
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4903
"/            'Stray recursionInterrupt ...' infoPrintCR.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4904
"/            ^ self
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4905
"/        ].
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  4906
        ObjectMemory infoPrinting ifTrue:[
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  4907
            'Object [info]: recursionInterrupt from:' printCR.
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  4908
            con := con sender.
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  4909
            remaining := 50.
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  4910
            [con notNil and:[remaining > 0]] whileTrue:[
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  4911
                sender := con sender.
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  4912
                '| ' print. con fullPrint.
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  4913
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  4914
                nSkipped := 0.
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  4915
                [sender notNil and:[sender sender notNil
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  4916
                and:[sender selector == con selector
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  4917
                and:[sender sender selector == con selector
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  4918
                and:[sender method == con method]]]]] whileTrue:[
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  4919
                    nSkipped := nSkipped + 1.
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  4920
                    con := sender.
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  4921
                    sender := con sender.
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  4922
                ].
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  4923
                nSkipped > 0 ifTrue:[
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  4924
                    '| ... ***** ' print. nSkipped print. ' recursive contexts skipped *****' printCR.
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  4925
                ].
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  4926
                con := sender.
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  4927
                remaining := remaining - 1
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  4928
            ].
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  4929
        ].
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  4930
        ^ RecursionInterruptSignal raiseSignal
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4931
    ]
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4932
6175
e9970db3e02f recursionInterrupt fixes for win32 (& comment changed)
Claus Gittinger <cg@exept.de>
parents: 6157
diff changeset
  4933
    "Modified: / 10.11.2001 / 15:15:56 / cg"
5755
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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4936
schedulerInterrupt
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4937
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4938
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4939
    "scheduler interrupt (supposed to be sent to Processor).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4940
     If we arrive here, either the Processor does not understand it,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4941
     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
  4942
     big trouble. Enter debugger."
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
    self error:'schedulerInterrupt - but no Processor' mayProceed:true
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4945
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4946
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4947
signalInterrupt:signalNumber
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4948
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4949
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  4950
    "unix signal occured - some signals are handled as Smalltalk Exceptions
10016
e174cf2d1f43 crash save refactored
Claus Gittinger <cg@exept.de>
parents: 9993
diff changeset
  4951
     (SIGPIPE), others (SIGBUS) are rather fatal...
11236
c196f9dedf66 exception description in debugger
Claus Gittinger <cg@exept.de>
parents: 11221
diff changeset
  4952
     In any case, IF a smalltalk-signal has been connected to the OS signal, that one is raised.
c196f9dedf66 exception description in debugger
Claus Gittinger <cg@exept.de>
parents: 11221
diff changeset
  4953
     Otherwise, a dialog is shown, asking the user on how to handle the signal.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4954
     TODO: add another argument, giving more detailed signal info (PC, VADDR,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4955
     exact cause etc.). This helps if segvs occur in primitive code.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4956
     Currently (temporary kludge), these are passed as global variables."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4957
6537
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  4958
    |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
  4959
     action title screen|
41396e0cc89f Fix #signalInterrupt: for multi-display and headless.
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
  4960
13254
5cf789a74946 changed: #signalInterrupt:
Claus Gittinger <cg@exept.de>
parents: 13229
diff changeset
  4961
    thisContext isRecursive ifTrue:[
13578
aa9827cafc2c signalInterrupt: - tell which process was killed
Claus Gittinger <cg@exept.de>
parents: 13566
diff changeset
  4962
        'Severe error: signalInterrupt while processing a signalInterrupt.' errorPrintCR.
aa9827cafc2c signalInterrupt: - tell which process was killed
Claus Gittinger <cg@exept.de>
parents: 13566
diff changeset
  4963
        'Terminating process ' errorPrint. Processor activeProcess errorPrintCR.
13710
277f3a5697e8 changed: #signalInterrupt:
Claus Gittinger <cg@exept.de>
parents: 13656
diff changeset
  4964
"/        GenericException handle:[:ex |
277f3a5697e8 changed: #signalInterrupt:
Claus Gittinger <cg@exept.de>
parents: 13656
diff changeset
  4965
"/            "/ ignore any error during termination
277f3a5697e8 changed: #signalInterrupt:
Claus Gittinger <cg@exept.de>
parents: 13656
diff changeset
  4966
"/        ] do:[
277f3a5697e8 changed: #signalInterrupt:
Claus Gittinger <cg@exept.de>
parents: 13656
diff changeset
  4967
"/           Processor activeProcess terminate.
277f3a5697e8 changed: #signalInterrupt:
Claus Gittinger <cg@exept.de>
parents: 13656
diff changeset
  4968
"/        ].
13261
Claus Gittinger <cg@exept.de>
parents: 13258
diff changeset
  4969
        Processor activeProcess terminateNoSignal.
13254
5cf789a74946 changed: #signalInterrupt:
Claus Gittinger <cg@exept.de>
parents: 13229
diff changeset
  4970
    ].
5cf789a74946 changed: #signalInterrupt:
Claus Gittinger <cg@exept.de>
parents: 13229
diff changeset
  4971
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4972
    "if there has been an ST-signal installed, use it ..."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4973
    sig := OperatingSystem operatingSystemSignal:signalNumber.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4974
    sig notNil ifTrue:[
13261
Claus Gittinger <cg@exept.de>
parents: 13258
diff changeset
  4975
        sig raiseSignalWith:signalNumber.
Claus Gittinger <cg@exept.de>
parents: 13258
diff changeset
  4976
        ^ self.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4977
    ].
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
    "/ if handled, raise OSSignalInterruptSignal
8330
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
  4980
    OSSignalInterrupt isHandled ifTrue:[
13261
Claus Gittinger <cg@exept.de>
parents: 13258
diff changeset
  4981
        OSSignalInterrupt raiseRequestWith:signalNumber.
Claus Gittinger <cg@exept.de>
parents: 13258
diff changeset
  4982
        ^ self.
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  4983
    ].
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  4984
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  4985
    "
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  4986
     special cases
13261
Claus Gittinger <cg@exept.de>
parents: 13258
diff changeset
  4987
        - SIGPWR: power failure - write a crash image and continue
Claus Gittinger <cg@exept.de>
parents: 13258
diff changeset
  4988
        - SIGHUP: hang up - write a crash image and exit
10922
a1ff606fca18 #signalInterrupt: - comment
Stefan Vogel <sv@exept.de>
parents: 10918
diff changeset
  4989
    "
a1ff606fca18 #signalInterrupt: - comment
Stefan Vogel <sv@exept.de>
parents: 10918
diff changeset
  4990
    (signalNumber == OperatingSystem sigPWR) ifTrue:[
13261
Claus Gittinger <cg@exept.de>
parents: 13258
diff changeset
  4991
        SnapshotError ignoreIn:[ObjectMemory writeCrashImage].
Claus Gittinger <cg@exept.de>
parents: 13258
diff changeset
  4992
        ^ self.
10922
a1ff606fca18 #signalInterrupt: - comment
Stefan Vogel <sv@exept.de>
parents: 10918
diff changeset
  4993
    ].
a1ff606fca18 #signalInterrupt: - comment
Stefan Vogel <sv@exept.de>
parents: 10918
diff changeset
  4994
    (signalNumber == OperatingSystem sigHUP) ifTrue:[
13261
Claus Gittinger <cg@exept.de>
parents: 13258
diff changeset
  4995
        SnapshotError ignoreIn:[ObjectMemory writeCrashImage].
Claus Gittinger <cg@exept.de>
parents: 13258
diff changeset
  4996
        'Object [info]: exit due to hangup signal.' errorPrintCR.
Claus Gittinger <cg@exept.de>
parents: 13258
diff changeset
  4997
        Smalltalk exit:1.
7031
eae2df0a3ad2 Exit Smalltalk in SIGHUP
Stefan Vogel <sv@exept.de>
parents: 6964
diff changeset
  4998
    ].
5856
6d3df9ad361e save crash image when sigPWR or sigHUP arrives
Claus Gittinger <cg@exept.de>
parents: 5824
diff changeset
  4999
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5000
    name := OperatingSystem nameForSignal:signalNumber.
6388
41396e0cc89f Fix #signalInterrupt: for multi-display and headless.
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
  5001
41396e0cc89f Fix #signalInterrupt: for multi-display and headless.
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
  5002
    "if there is no screen at all, bring up a mini debugger"
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  5003
    (Screen isNil
6388
41396e0cc89f Fix #signalInterrupt: for multi-display and headless.
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
  5004
     or:[(screen := Screen current) isNil
6778
87e2d95ce8a4 Raise #drawingOnClosedDeviceSignal instead of #error
Stefan Vogel <sv@exept.de>
parents: 6764
diff changeset
  5005
     or:[(screen := Screen default) isNil
87e2d95ce8a4 Raise #drawingOnClosedDeviceSignal instead of #error
Stefan Vogel <sv@exept.de>
parents: 6764
diff changeset
  5006
     or:[screen isOpen not]]]) ifTrue:[
13261
Claus Gittinger <cg@exept.de>
parents: 13258
diff changeset
  5007
        ^ self startMiniDebuggerOrExit:'OS-Signal (' , name, ')'.
6388
41396e0cc89f Fix #signalInterrupt: for multi-display and headless.
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
  5008
    ].
41396e0cc89f Fix #signalInterrupt: for multi-display and headless.
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
  5009
41396e0cc89f Fix #signalInterrupt: for multi-display and headless.
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
  5010
    "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
  5011
     otherwise display stays locked"
41396e0cc89f Fix #signalInterrupt: for multi-display and headless.
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
  5012
    screen ungrabPointer; ungrabKeyboard.
41396e0cc89f Fix #signalInterrupt: for multi-display and headless.
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
  5013
7031
eae2df0a3ad2 Exit Smalltalk in SIGHUP
Stefan Vogel <sv@exept.de>
parents: 6964
diff changeset
  5014
    here := thisContext.
eae2df0a3ad2 Exit Smalltalk in SIGHUP
Stefan Vogel <sv@exept.de>
parents: 6964
diff changeset
  5015
    badContext := here sender.          "the context, in which the signal occurred"
eae2df0a3ad2 Exit Smalltalk in SIGHUP
Stefan Vogel <sv@exept.de>
parents: 6964
diff changeset
  5016
6388
41396e0cc89f Fix #signalInterrupt: for multi-display and headless.
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
  5017
    "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
  5018
    Screen currentScreenQuerySignal answer:screen do:[
13261
Claus Gittinger <cg@exept.de>
parents: 13258
diff changeset
  5019
        "
Claus Gittinger <cg@exept.de>
parents: 13258
diff changeset
  5020
         SIGBUS, SIGSEGV and SIGILL do not make sense to ignore (i.e. continue)
Claus Gittinger <cg@exept.de>
parents: 13258
diff changeset
  5021
         since the system will retry the faulty instruction, which leads to
Claus Gittinger <cg@exept.de>
parents: 13258
diff changeset
  5022
         another signal - to avoid frustration, better not offer this option.
Claus Gittinger <cg@exept.de>
parents: 13258
diff changeset
  5023
        "
Claus Gittinger <cg@exept.de>
parents: 13258
diff changeset
  5024
        fatal := OperatingSystem isFatalSignal:signalNumber.
Claus Gittinger <cg@exept.de>
parents: 13258
diff changeset
  5025
        fatal ifTrue:[
Claus Gittinger <cg@exept.de>
parents: 13258
diff changeset
  5026
            (Debugger isNil or:[here isRecursive]) ifTrue:[
Claus Gittinger <cg@exept.de>
parents: 13258
diff changeset
  5027
                'Object [hard error]: signal ' errorPrint. signalNumber errorPrintCR.
Claus Gittinger <cg@exept.de>
parents: 13258
diff changeset
  5028
                ^ self startMiniDebuggerOrExit:'OS-Signal (' , name, ')'.
Claus Gittinger <cg@exept.de>
parents: 13258
diff changeset
  5029
            ].
Claus Gittinger <cg@exept.de>
parents: 13258
diff changeset
  5030
            "
Claus Gittinger <cg@exept.de>
parents: 13258
diff changeset
  5031
             a hard signal - go into debugger immediately
Claus Gittinger <cg@exept.de>
parents: 13258
diff changeset
  5032
            "
Claus Gittinger <cg@exept.de>
parents: 13258
diff changeset
  5033
            msg := 'OS-signal: ', name.
Claus Gittinger <cg@exept.de>
parents: 13258
diff changeset
  5034
Claus Gittinger <cg@exept.de>
parents: 13258
diff changeset
  5035
            "/ the IRQ-PC is passed as low-hi, to avoid the need
Claus Gittinger <cg@exept.de>
parents: 13258
diff changeset
  5036
            "/ to allocate a LargeInteger in the VM during signal
Claus Gittinger <cg@exept.de>
parents: 13258
diff changeset
  5037
            "/ time. I know, this is ugly.
Claus Gittinger <cg@exept.de>
parents: 13258
diff changeset
  5038
Claus Gittinger <cg@exept.de>
parents: 13258
diff changeset
  5039
            InterruptPcLow notNil ifTrue:[
Claus Gittinger <cg@exept.de>
parents: 13258
diff changeset
  5040
                pc := InterruptPcLow + (InterruptPcHi bitShift:((SmallInteger maxBits + 1) // 2)).
Claus Gittinger <cg@exept.de>
parents: 13258
diff changeset
  5041
                pc ~~ 0 ifTrue:[
Claus Gittinger <cg@exept.de>
parents: 13258
diff changeset
  5042
                    msg := msg , ' PC=' , (pc printStringRadix:16)
Claus Gittinger <cg@exept.de>
parents: 13258
diff changeset
  5043
                ].
Claus Gittinger <cg@exept.de>
parents: 13258
diff changeset
  5044
            ].
Claus Gittinger <cg@exept.de>
parents: 13258
diff changeset
  5045
            InterruptAddrLow notNil ifTrue:[
Claus Gittinger <cg@exept.de>
parents: 13258
diff changeset
  5046
                addr := InterruptAddrLow + (InterruptAddrHi bitShift:((SmallInteger maxBits + 1) // 2)).
Claus Gittinger <cg@exept.de>
parents: 13258
diff changeset
  5047
                addr ~~ 0 ifTrue:[
Claus Gittinger <cg@exept.de>
parents: 13258
diff changeset
  5048
                    msg := msg , ' ADDR=' , (addr printStringRadix:16)
Claus Gittinger <cg@exept.de>
parents: 13258
diff changeset
  5049
                ].
Claus Gittinger <cg@exept.de>
parents: 13258
diff changeset
  5050
            ].
Claus Gittinger <cg@exept.de>
parents: 13258
diff changeset
  5051
            Debugger enter:here withMessage:msg mayProceed:false.
Claus Gittinger <cg@exept.de>
parents: 13258
diff changeset
  5052
            "unreachable"
Claus Gittinger <cg@exept.de>
parents: 13258
diff changeset
  5053
            ^ nil.
Claus Gittinger <cg@exept.de>
parents: 13258
diff changeset
  5054
        ].
Claus Gittinger <cg@exept.de>
parents: 13258
diff changeset
  5055
Claus Gittinger <cg@exept.de>
parents: 13258
diff changeset
  5056
        "if possible, open an option box asking the user what do.
Claus Gittinger <cg@exept.de>
parents: 13258
diff changeset
  5057
         Otherwise, start a debugger"
Claus Gittinger <cg@exept.de>
parents: 13258
diff changeset
  5058
        Dialog notNil ifTrue:[
Claus Gittinger <cg@exept.de>
parents: 13258
diff changeset
  5059
            titles := #('save crash image' 'dump core' 'exit ST/X' 'debug').
Claus Gittinger <cg@exept.de>
parents: 13258
diff changeset
  5060
            actions := #(save core exit debug).
Claus Gittinger <cg@exept.de>
parents: 13258
diff changeset
  5061
Claus Gittinger <cg@exept.de>
parents: 13258
diff changeset
  5062
            action := nil.
Claus Gittinger <cg@exept.de>
parents: 13258
diff changeset
  5063
            title := 'OS Signal caught (' , name, ')'.
Claus Gittinger <cg@exept.de>
parents: 13258
diff changeset
  5064
            title := (title , '\[in ST-process: ' , Processor activeProcess nameOrId ,']') withCRs.
Claus Gittinger <cg@exept.de>
parents: 13258
diff changeset
  5065
Claus Gittinger <cg@exept.de>
parents: 13258
diff changeset
  5066
            "/ if cought while in the scheduler or event dispatcher,
Claus Gittinger <cg@exept.de>
parents: 13258
diff changeset
  5067
            "/ a modal dialog is not possible ...
Claus Gittinger <cg@exept.de>
parents: 13258
diff changeset
  5068
            "/ (therefore, abort & return does not makes sense)
Claus Gittinger <cg@exept.de>
parents: 13258
diff changeset
  5069
Claus Gittinger <cg@exept.de>
parents: 13258
diff changeset
  5070
            Processor activeProcess isSystemProcess ifFalse:[
Claus Gittinger <cg@exept.de>
parents: 13258
diff changeset
  5071
                titles := #('abort') , titles.
Claus Gittinger <cg@exept.de>
parents: 13258
diff changeset
  5072
                actions := #(abort), actions.
Claus Gittinger <cg@exept.de>
parents: 13258
diff changeset
  5073
Claus Gittinger <cg@exept.de>
parents: 13258
diff changeset
  5074
                badContext canReturn ifTrue:[
Claus Gittinger <cg@exept.de>
parents: 13258
diff changeset
  5075
                    titles := #('return') , titles.
Claus Gittinger <cg@exept.de>
parents: 13258
diff changeset
  5076
                    actions :=  #(return), actions.
Claus Gittinger <cg@exept.de>
parents: 13258
diff changeset
  5077
                ].
Claus Gittinger <cg@exept.de>
parents: 13258
diff changeset
  5078
            ].
Claus Gittinger <cg@exept.de>
parents: 13258
diff changeset
  5079
Claus Gittinger <cg@exept.de>
parents: 13258
diff changeset
  5080
            fatal ifFalse:[
Claus Gittinger <cg@exept.de>
parents: 13258
diff changeset
  5081
                titles := titles, #('ignore').
Claus Gittinger <cg@exept.de>
parents: 13258
diff changeset
  5082
                actions := actions , #(ignore).
Claus Gittinger <cg@exept.de>
parents: 13258
diff changeset
  5083
            ].
Claus Gittinger <cg@exept.de>
parents: 13258
diff changeset
  5084
            action := Dialog choose:title
Claus Gittinger <cg@exept.de>
parents: 13258
diff changeset
  5085
                             labels:titles
Claus Gittinger <cg@exept.de>
parents: 13258
diff changeset
  5086
                             values:actions
Claus Gittinger <cg@exept.de>
parents: 13258
diff changeset
  5087
                             default:(fatal ifTrue:[nil] ifFalse:[#ignore]).
Claus Gittinger <cg@exept.de>
parents: 13258
diff changeset
  5088
Claus Gittinger <cg@exept.de>
parents: 13258
diff changeset
  5089
            "Dialog may fail (if system process), default action is debug"
Claus Gittinger <cg@exept.de>
parents: 13258
diff changeset
  5090
            action isEmptyOrNil ifTrue:[action := #debug].
Claus Gittinger <cg@exept.de>
parents: 13258
diff changeset
  5091
        ] ifFalse:[
Claus Gittinger <cg@exept.de>
parents: 13258
diff changeset
  5092
            action := #debug.
Claus Gittinger <cg@exept.de>
parents: 13258
diff changeset
  5093
        ].
Claus Gittinger <cg@exept.de>
parents: 13258
diff changeset
  5094
Claus Gittinger <cg@exept.de>
parents: 13258
diff changeset
  5095
        action == #save ifTrue:[
Claus Gittinger <cg@exept.de>
parents: 13258
diff changeset
  5096
            ObjectMemory writeCrashImage
Claus Gittinger <cg@exept.de>
parents: 13258
diff changeset
  5097
        ].
Claus Gittinger <cg@exept.de>
parents: 13258
diff changeset
  5098
        action == #core ifTrue:[
Claus Gittinger <cg@exept.de>
parents: 13258
diff changeset
  5099
            Smalltalk fatalAbort
Claus Gittinger <cg@exept.de>
parents: 13258
diff changeset
  5100
        ].
Claus Gittinger <cg@exept.de>
parents: 13258
diff changeset
  5101
        action == #exit ifTrue:[
Claus Gittinger <cg@exept.de>
parents: 13258
diff changeset
  5102
            Smalltalk exit
Claus Gittinger <cg@exept.de>
parents: 13258
diff changeset
  5103
        ].
Claus Gittinger <cg@exept.de>
parents: 13258
diff changeset
  5104
        action == #return ifTrue:[
Claus Gittinger <cg@exept.de>
parents: 13258
diff changeset
  5105
            badContext return
Claus Gittinger <cg@exept.de>
parents: 13258
diff changeset
  5106
        ].
Claus Gittinger <cg@exept.de>
parents: 13258
diff changeset
  5107
        action == #abort ifTrue:[
Claus Gittinger <cg@exept.de>
parents: 13258
diff changeset
  5108
            AbortOperationRequest raise.
Claus Gittinger <cg@exept.de>
parents: 13258
diff changeset
  5109
        ].
Claus Gittinger <cg@exept.de>
parents: 13258
diff changeset
  5110
Claus Gittinger <cg@exept.de>
parents: 13258
diff changeset
  5111
        action == #debug ifTrue:[
Claus Gittinger <cg@exept.de>
parents: 13258
diff changeset
  5112
            Debugger isNil ifTrue:[
Claus Gittinger <cg@exept.de>
parents: 13258
diff changeset
  5113
                ^ self startMiniDebuggerOrExit:'OS-Signal (' , name, ')'.
Claus Gittinger <cg@exept.de>
parents: 13258
diff changeset
  5114
            ].
Claus Gittinger <cg@exept.de>
parents: 13258
diff changeset
  5115
            Debugger enter:here withMessage:('OS-Signal ', name) mayProceed:true.
Claus Gittinger <cg@exept.de>
parents: 13258
diff changeset
  5116
        ].
Claus Gittinger <cg@exept.de>
parents: 13258
diff changeset
  5117
        "action == #ignore"
Claus Gittinger <cg@exept.de>
parents: 13258
diff changeset
  5118
    ].
Claus Gittinger <cg@exept.de>
parents: 13258
diff changeset
  5119
13710
277f3a5697e8 changed: #signalInterrupt:
Claus Gittinger <cg@exept.de>
parents: 13656
diff changeset
  5120
    "Modified: / 15-09-2011 / 16:38:14 / cg"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5121
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5122
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5123
spyInterrupt
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5124
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5125
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5126
    "spy interrupt and no handler - enter debugger"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5127
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5128
    self error:'spy Interrupt - but no handler' mayProceed:true
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
6388
41396e0cc89f Fix #signalInterrupt: for multi-display and headless.
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
  5131
startMiniDebuggerOrExit:text
41396e0cc89f Fix #signalInterrupt: for multi-display and headless.
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
  5132
    "some critical condition happened.
41396e0cc89f Fix #signalInterrupt: for multi-display and headless.
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
  5133
     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
  5134
41396e0cc89f Fix #signalInterrupt: for multi-display and headless.
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
  5135
    MiniDebugger isNil ifTrue:[
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5136
        "a system without debugging facilities (i.e. a standalone system)
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5137
         output a message and exit."
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5138
        ('Object [error]: exit due to ', text, ' - and no debugger.') errorPrintCR.
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5139
        OperatingSystem exit:99.
6388
41396e0cc89f Fix #signalInterrupt: for multi-display and headless.
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
  5140
    ].
41396e0cc89f Fix #signalInterrupt: for multi-display and headless.
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
  5141
    MiniDebugger enterWithMessage:text mayProceed:true.
41396e0cc89f Fix #signalInterrupt: for multi-display and headless.
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
  5142
!
41396e0cc89f Fix #signalInterrupt: for multi-display and headless.
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
  5143
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5144
timerInterrupt
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5145
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5146
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5147
    "timer interrupt and no handler - enter debugger"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5148
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5149
    self error:'timer Interrupt - but no handler' mayProceed:true
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5150
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5151
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5152
userInterrupt
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5153
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5154
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5155
    "user (^c) interrupt.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5156
     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
  5157
     controlling tty (i.e. in the xterm)."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5158
6466
ae28dd895a58 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6461
diff changeset
  5159
    UserInterruptSignal raiseRequest
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5160
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5161
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5162
userInterruptIn:aContext
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5163
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5164
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5165
    "user (^c) interrupt - enter debugger, but show aContext
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  5166
     as top-context.
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  5167
     This is used to hide any intermediate scheduler contexts,
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5168
     in case of an interrupted process. Typically, this is sent by
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5169
     the WindowGroup, when a keyboardEvent for the ctrl-C key is
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5170
     processed."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5171
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5172
    <context: #return>
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5173
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5174
    UserInterruptSignal raiseRequestWith:nil errorString:nil in:aContext
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5175
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5176
    "Created: / 18.10.1996 / 20:46:04 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5177
    "Modified: / 20.10.1996 / 13:06:38 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5178
    "Modified: / 26.7.1999 / 10:58:49 / stefan"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5179
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5180
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5181
!Object methodsFor:'message sending'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5182
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5183
perform:aSelector
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5184
    "send the message aSelector to the receiver"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5185
11335
c061d08b766f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11314
diff changeset
  5186
    <resource: #skipInDebuggersWalkBack>
c061d08b766f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11314
diff changeset
  5187
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5188
%{
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5189
    REGISTER OBJ sel = aSelector;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5190
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5191
    if (InterruptPending == nil) {
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5192
        struct inlineCache *pIlc;
13416
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5193
    /* JV @ 2010-22-07: To improve performance I use 256 ILCs instead
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5194
       of default 4. This significantly reduces ILC misses. The code 
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5195
       should be further optimized by remembering last selector index and 
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5196
       try a first shot on that index. Another option is to use kind of 
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5197
       hashing on lower bits of sel variable. However, a more detailed 
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5198
       statistical data should be gathered before doing further optimizations.
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5199
    */
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5200
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5201
#define SEL_AND_ILC_INIT_1(l)   { nil , __ILCPERF0(l) }
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5202
#define SEL_AND_ILC_INIT_2(l)   SEL_AND_ILC_INIT_1(l)   , SEL_AND_ILC_INIT_1(l)
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5203
#define SEL_AND_ILC_INIT_4(l)   SEL_AND_ILC_INIT_2(l)   , SEL_AND_ILC_INIT_2(l)
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5204
#define SEL_AND_ILC_INIT_8(l)   SEL_AND_ILC_INIT_4(l)   , SEL_AND_ILC_INIT_4(l)
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5205
#define SEL_AND_ILC_INIT_16(l)  SEL_AND_ILC_INIT_8(l)   , SEL_AND_ILC_INIT_8(l)
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5206
#define SEL_AND_ILC_INIT_32(l)  SEL_AND_ILC_INIT_16(l)  , SEL_AND_ILC_INIT_16(l)
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5207
#define SEL_AND_ILC_INIT_32(l)  SEL_AND_ILC_INIT_16(l)  , SEL_AND_ILC_INIT_16(l)
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5208
#define SEL_AND_ILC_INIT_64(l)  SEL_AND_ILC_INIT_32(l)  , SEL_AND_ILC_INIT_32(l)
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5209
#define SEL_AND_ILC_INIT_128(l) SEL_AND_ILC_INIT_64(l)  , SEL_AND_ILC_INIT_64(l)
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5210
#define SEL_AND_ILC_INIT_256(l) SEL_AND_ILC_INIT_128(l) , SEL_AND_ILC_INIT_128(l)
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5211
#define nilcs 256
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5212
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5213
        static struct { OBJ sel; struct inlineCache ilc; } sel_and_ilc[nilcs] = { SEL_AND_ILC_INIT_256(29) };
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5214
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5215
#undef SEL_AND_ILC_INIT_1
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5216
#undef SEL_AND_ILC_INIT_2
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5217
#undef SEL_AND_ILC_INIT_4
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5218
#undef SEL_AND_ILC_INIT_8
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5219
#undef SEL_AND_ILC_INIT_16
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5220
#undef SEL_AND_ILC_INIT_32
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5221
#undef SEL_AND_ILC_INIT_64
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5222
#undef SEL_AND_ILC_INIT_128
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5223
#undef SEL_AND_ILC_INIT_256
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5224
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5225
        static flip = 0;
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5226
        int i;
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5227
        for (i = 0; i < nilcs; i++) {
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5228
           if (sel == sel_and_ilc[i].sel) {
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5229
                pIlc = &sel_and_ilc[i].ilc;
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5230
                goto perform0_send_and_return;
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5231
           }       
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5232
        }
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5233
        /*printf("Object >> #perform: #%s --> no PIC found\n", __symbolVal(aSelector));*/
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5234
        pIlc = &sel_and_ilc[flip].ilc;
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5235
        sel_and_ilc[flip].sel = sel;
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5236
        flip = (flip + 1) % nilcs;
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5237
        pIlc->ilc_func = __SEND0ADDR__;
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5238
        if (pIlc->ilc_poly) {
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5239
             __flushPolyCache(pIlc->ilc_poly);
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5240
            pIlc->ilc_poly = 0;
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5241
        }
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5242
perform0_send_and_return:
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5243
        RETURN ( (*(pIlc->ilc_func))(self, sel, nil, pIlc) );
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5244
    } else {
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5245
        static struct inlineCache ilc0 = __DUMMYILCSELF0(@line+1);
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5246
        RETURN (_SEND0(self, aSelector, nil, &ilc0));
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5247
    }
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5248
%}.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5249
    ^ self perform:aSelector withArguments:#()
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5250
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5251
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5252
perform:aSelector inClass:aClass withArguments:argArray
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  5253
    "send the message aSelector with all args taken from argArray
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5254
     to the receiver as a super-send message.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5255
     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
  5256
     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
  5257
     immediate superclass).
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  5258
     Thus, it is (theoretically) possible to do
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5259
         '5 perform:#< inClass:Magnitude withArguments:#(6)'
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5260
     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
  5261
     This method is used by the interpreter to evaluate super sends
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5262
     and could be used for very special behavior (language extension ?).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5263
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5264
     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
  5265
5769
8f874be55bc9 lookup-class check in #perform:inClass was too strong.
Claus Gittinger <cg@exept.de>
parents: 5755
diff changeset
  5266
    |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
  5267
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5268
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5269
     check, if aClass is really a superclass of the receiver
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5270
    "
5769
8f874be55bc9 lookup-class check in #perform:inClass was too strong.
Claus Gittinger <cg@exept.de>
parents: 5755
diff changeset
  5271
    myClass := self class.
8f874be55bc9 lookup-class check in #perform:inClass was too strong.
Claus Gittinger <cg@exept.de>
parents: 5755
diff changeset
  5272
    (myClass == aClass or:[myClass isSubclassOf:aClass]) ifFalse:[
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5273
        self error:'lookup-class argument is not a superclass of the receiver'.
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5274
        ^ nil
5755
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
%{
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5277
    REGISTER OBJ *argP;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5278
    int nargs, i;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5279
8934
32a063645991 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8930
diff changeset
  5280
    if (__isArrayLike(argArray)) {
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5281
        nargs = __arraySize(argArray);
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5282
        argP = __arrayVal(argArray);
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5283
    } else {
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5284
        if (__isNonNilObject(argArray)) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5285
            static struct inlineCache ilcSize = __ILC0(@line+1);
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5286
            numberOfArgs = (*ilcSize.ilc_func)(argArray, @symbol(size), nil, &ilcSize);
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5287
            if (!__isSmallInteger(numberOfArgs))
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5288
                goto bad;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5289
            nargs = __intVal(numberOfArgs);
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5290
            argP = (OBJ *)(&a1);
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5291
            for (i=1; i <= nargs; i++) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5292
                *argP++ = __AT_(argArray, __mkSmallInteger(i));
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5293
            }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5294
            argP = (OBJ *)(&a1);
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5295
        } else {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5296
            nargs = 0;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5297
        }
5755
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
    switch (nargs) {
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5300
        case 0:
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5301
            {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5302
                static struct inlineCache ilc0 = __DUMMYILCSELF0(@line+1);
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5303
                RETURN ( _SEND0(self, aSelector, aClass, &ilc0));
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5304
            }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5305
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5306
        case 1:
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5307
            {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5308
                static struct inlineCache ilc1 = __DUMMYILCSELF1(@line+1);
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5309
                RETURN ( _SEND1(self, aSelector, aClass, &ilc1, argP[0]));
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5310
            }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5311
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5312
        case 2:
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5313
            {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5314
                static struct inlineCache ilc2 = __DUMMYILCSELF2(@line+1);
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5315
                RETURN ( _SEND2(self, aSelector, aClass, &ilc2, argP[0], argP[1]));
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5316
            }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5317
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5318
        case 3:
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5319
            {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5320
                static struct inlineCache ilc3 = __DUMMYILCSELF3(@line+1);
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5321
                RETURN ( _SEND3(self, aSelector, aClass, &ilc3,
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5322
                                argP[0], argP[1], argP[2]));
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5323
            }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5324
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5325
        case 4:
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5326
            {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5327
                static struct inlineCache ilc4 = __DUMMYILCSELF4(@line+1);
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5328
                RETURN ( _SEND4(self, aSelector, aClass, &ilc4,
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5329
                                argP[0], argP[1], argP[2], argP[3]));
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5330
            }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5331
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5332
        case 5:
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5333
            {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5334
                static struct inlineCache ilc5 = __DUMMYILCSELF5(@line+1);
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5335
                RETURN ( _SEND5(self, aSelector, aClass, &ilc5,
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5336
                                argP[0], argP[1], argP[2], argP[3], argP[4]));
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5337
            }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5338
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5339
        case 6:
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5340
            {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5341
                static struct inlineCache ilc6 = __DUMMYILCSELF6(@line+1);
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5342
                RETURN ( _SEND6(self, aSelector, aClass, &ilc6,
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5343
                                argP[0], argP[1], argP[2], argP[3], argP[4], argP[5]));
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5344
            }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5345
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5346
        case 7:
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5347
            {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5348
                static struct inlineCache ilc7 = __DUMMYILCSELF7(@line+1);
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5349
                RETURN ( _SEND7(self, aSelector, aClass, &ilc7,
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5350
                                argP[0], argP[1], argP[2], argP[3], argP[4], argP[5],
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5351
                                argP[6]));
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5352
            }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5353
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5354
        case 8:
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5355
            {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5356
                static struct inlineCache ilc8 = __DUMMYILCSELF8(@line+1);
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5357
                RETURN ( _SEND8(self, aSelector, aClass, &ilc8,
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5358
                                argP[0], argP[1], argP[2], argP[3], argP[4], argP[5],
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5359
                                argP[6], argP[7]));
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5360
            }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5361
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5362
        case 9:
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5363
            {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5364
                static struct inlineCache ilc9 = __DUMMYILCSELF9(@line+1);
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5365
                RETURN ( _SEND9(self, aSelector, aClass, &ilc9,
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5366
                                argP[0], argP[1], argP[2], argP[3], argP[4], argP[5],
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5367
                                argP[6], argP[7], argP[8]));
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5368
            }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5369
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5370
        case 10:
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5371
            {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5372
                static struct inlineCache ilc10 = __DUMMYILCSELF10(@line+1);
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5373
                RETURN ( _SEND10(self, aSelector, aClass, &ilc10,
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5374
                                 argP[0], argP[1], argP[2], argP[3], argP[4], argP[5],
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5375
                                 argP[6], argP[7], argP[8], argP[9]));
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5376
            }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5377
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5378
        case 11:
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5379
            {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5380
                static struct inlineCache ilc11 = __DUMMYILCSELF11(@line+1);
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5381
                RETURN ( _SEND11(self, aSelector, aClass, &ilc11,
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5382
                                 argP[0], argP[1], argP[2], argP[3], argP[4], argP[5],
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5383
                                 argP[6], argP[7], argP[8], argP[9], argP[10]));
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5384
            }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5385
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5386
        case 12:
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5387
            {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5388
                static struct inlineCache ilc12 = __DUMMYILCSELF12(@line+1);
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5389
                RETURN ( _SEND12(self, aSelector, aClass, &ilc12,
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5390
                                 argP[0], argP[1], argP[2], argP[3], argP[4], argP[5],
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5391
                                 argP[6], argP[7], argP[8], argP[9], argP[10],
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5392
                                 argP[11]));
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5393
            }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5394
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5395
        case 13:
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5396
            {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5397
                static struct inlineCache ilc13 = __DUMMYILCSELF13(@line+1);
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5398
                RETURN ( _SEND13(self, aSelector, aClass, &ilc13,
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5399
                                 argP[0], argP[1], argP[2], argP[3], argP[4], argP[5],
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5400
                                 argP[6], argP[7], argP[8], argP[9], argP[10],
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5401
                                 argP[11], argP[12]));
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5402
            }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5403
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5404
        case 14:
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5405
            {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5406
                static struct inlineCache ilc14 = __DUMMYILCSELF14(@line+1);
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5407
                RETURN ( _SEND14(self, aSelector, aClass, &ilc14,
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5408
                                 argP[0], argP[1], argP[2], argP[3], argP[4], argP[5],
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5409
                                 argP[6], argP[7], argP[8], argP[9], argP[10],
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5410
                                 argP[11], argP[12], argP[13]));
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5411
            }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5412
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5413
        case 15:
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5414
            {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5415
                static struct inlineCache ilc15 = __DUMMYILCSELF15(@line+1);
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5416
                RETURN ( _SEND15(self, aSelector, aClass, &ilc15,
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5417
                                 argP[0], argP[1], argP[2], argP[3], argP[4], argP[5],
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5418
                                 argP[6], argP[7], argP[8], argP[9], argP[10],
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5419
                                 argP[11], argP[12], argP[13], argP[14]));
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5420
            }
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
#ifdef _SEND16
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5423
        case 16:
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5424
            {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5425
                static struct inlineCache ilc16 = __DUMMYILCSELF16(@line+1);
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5426
                RETURN ( _SEND16(self, aSelector, aClass, &ilc15,
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5427
                                 argP[0], argP[1], argP[2], argP[3], argP[4], argP[5],
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5428
                                 argP[6], argP[7], argP[8], argP[9], argP[10],
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5429
                                 argP[11], argP[12], argP[13], argP[14], argP[15]));
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5430
            }
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5431
#endif
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5432
#ifdef _SEND17
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5433
        case 17:
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5434
            {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5435
                static struct inlineCache ilc17 = __DUMMYILCSELF17(@line+1);
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5436
                RETURN ( _SEND17(self, aSelector, aClass, &ilc15,
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5437
                                 argP[0], argP[1], argP[2], argP[3], argP[4], argP[5],
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5438
                                 argP[6], argP[7], argP[8], argP[9], argP[10],
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5439
                                 argP[11], argP[12], argP[13], argP[14], argP[15], argP[16]));
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5440
            }
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5441
#endif
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5442
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5443
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
bad:;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5446
%}.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5447
    "/ arrive here, if bad number of arguments (too many)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5448
    "/ ST/X (currently) only allows up to 15 method arguments
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5449
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5450
    ^ self primitiveFailed
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5451
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5452
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5453
perform:aSelector with:arg
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5454
    "send the one-arg-message aSelector to the receiver"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5455
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5456
%{
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5457
    REGISTER OBJ sel = aSelector;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5458
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5459
    if (InterruptPending == nil) {
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5460
        struct inlineCache *pIlc;
13416
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5461
    /* JV @ 2010-22-07: To improve performance I use 256 ILCs instead
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5462
       of default 4. For details, see comment in perform: */
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5463
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5464
#define SEL_AND_ILC_INIT_1(l)   { nil , __ILCPERF1(l) }
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5465
#define SEL_AND_ILC_INIT_2(l)   SEL_AND_ILC_INIT_1(l)   , SEL_AND_ILC_INIT_1(l)
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5466
#define SEL_AND_ILC_INIT_4(l)   SEL_AND_ILC_INIT_2(l)   , SEL_AND_ILC_INIT_2(l)
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5467
#define SEL_AND_ILC_INIT_8(l)   SEL_AND_ILC_INIT_4(l)   , SEL_AND_ILC_INIT_4(l)
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5468
#define SEL_AND_ILC_INIT_16(l)  SEL_AND_ILC_INIT_8(l)   , SEL_AND_ILC_INIT_8(l)
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5469
#define SEL_AND_ILC_INIT_32(l)  SEL_AND_ILC_INIT_16(l)  , SEL_AND_ILC_INIT_16(l)
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5470
#define SEL_AND_ILC_INIT_32(l)  SEL_AND_ILC_INIT_16(l)  , SEL_AND_ILC_INIT_16(l)
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5471
#define SEL_AND_ILC_INIT_64(l)  SEL_AND_ILC_INIT_32(l)  , SEL_AND_ILC_INIT_32(l)
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5472
#define SEL_AND_ILC_INIT_128(l) SEL_AND_ILC_INIT_64(l)  , SEL_AND_ILC_INIT_64(l)
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5473
#define SEL_AND_ILC_INIT_256(l) SEL_AND_ILC_INIT_128(l) , SEL_AND_ILC_INIT_128(l)
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5474
#define nilcs 256
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5475
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5476
        static struct { OBJ sel; struct inlineCache ilc; } sel_and_ilc[nilcs] = { SEL_AND_ILC_INIT_256(29) };
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5477
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5478
#undef SEL_AND_ILC_INIT_1
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5479
#undef SEL_AND_ILC_INIT_2
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5480
#undef SEL_AND_ILC_INIT_4
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5481
#undef SEL_AND_ILC_INIT_8
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5482
#undef SEL_AND_ILC_INIT_16
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5483
#undef SEL_AND_ILC_INIT_32
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5484
#undef SEL_AND_ILC_INIT_64
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5485
#undef SEL_AND_ILC_INIT_128
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5486
#undef SEL_AND_ILC_INIT_256
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5487
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5488
        static flip = 0;
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5489
        int i;
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5490
        for (i = 0; i < nilcs; i++) {
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5491
           if (sel == sel_and_ilc[i].sel) {
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5492
                pIlc = &sel_and_ilc[i].ilc;
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5493
                goto perform1_send_and_return;
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5494
           }       
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5495
        }
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5496
        /*printf("Object >> #perform: #%s with: arg --> no PIC found\n", __symbolVal(aSelector));*/
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5497
        pIlc = &sel_and_ilc[flip].ilc;
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5498
        sel_and_ilc[flip].sel = sel;
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5499
        flip = (flip + 1) % nilcs;
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5500
        pIlc->ilc_func = __SEND1ADDR__;
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5501
        if (pIlc->ilc_poly) {
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5502
             __flushPolyCache(pIlc->ilc_poly);
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5503
            pIlc->ilc_poly = 0;
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5504
        }
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5505
perform1_send_and_return:
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5506
        RETURN ( (*(pIlc->ilc_func))(self, sel, nil, pIlc, arg) );
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5507
    } else {
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5508
        static struct inlineCache ilc1 = __DUMMYILCSELF1(@line+1);
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5509
        RETURN (_SEND1(self, aSelector, nil, &ilc1, arg));
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5510
    }
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5511
%}.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5512
    ^ self perform:aSelector withArguments:(Array with:arg)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5513
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5514
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5515
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5516
perform:aSelector with:arg1 with:arg2
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5517
    "send the two-arg-message aSelector to the receiver"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5518
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5519
%{
13416
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5520
    REGISTER OBJ sel = aSelector;
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5521
    struct inlineCache *pIlc;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5522
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5523
    if (InterruptPending == nil) {
13416
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5524
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5525
    /* JV @ 2010-22-07: To improve performance I use 256 ILCs instead
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5526
       of default 4. For details, see comment in perform: */
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5527
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5528
#define SEL_AND_ILC_INIT_1(l)   { nil , __ILCPERF2(l) }
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5529
#define SEL_AND_ILC_INIT_2(l)   SEL_AND_ILC_INIT_1(l)   , SEL_AND_ILC_INIT_1(l)
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5530
#define SEL_AND_ILC_INIT_4(l)   SEL_AND_ILC_INIT_2(l)   , SEL_AND_ILC_INIT_2(l)
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5531
#define SEL_AND_ILC_INIT_8(l)   SEL_AND_ILC_INIT_4(l)   , SEL_AND_ILC_INIT_4(l)
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5532
#define SEL_AND_ILC_INIT_16(l)  SEL_AND_ILC_INIT_8(l)   , SEL_AND_ILC_INIT_8(l)
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5533
#define SEL_AND_ILC_INIT_32(l)  SEL_AND_ILC_INIT_16(l)  , SEL_AND_ILC_INIT_16(l)
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5534
#define SEL_AND_ILC_INIT_32(l)  SEL_AND_ILC_INIT_16(l)  , SEL_AND_ILC_INIT_16(l)
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5535
#define SEL_AND_ILC_INIT_64(l)  SEL_AND_ILC_INIT_32(l)  , SEL_AND_ILC_INIT_32(l)
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5536
#define SEL_AND_ILC_INIT_128(l) SEL_AND_ILC_INIT_64(l)  , SEL_AND_ILC_INIT_64(l)
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5537
#define SEL_AND_ILC_INIT_256(l) SEL_AND_ILC_INIT_128(l) , SEL_AND_ILC_INIT_128(l)
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5538
#define nilcs 256
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5539
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5540
        static struct { OBJ sel; struct inlineCache ilc; } sel_and_ilc[nilcs] = { SEL_AND_ILC_INIT_256(29) };
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5541
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5542
#undef SEL_AND_ILC_INIT_1
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5543
#undef SEL_AND_ILC_INIT_2
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5544
#undef SEL_AND_ILC_INIT_4
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5545
#undef SEL_AND_ILC_INIT_8
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5546
#undef SEL_AND_ILC_INIT_16
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5547
#undef SEL_AND_ILC_INIT_32
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5548
#undef SEL_AND_ILC_INIT_64
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5549
#undef SEL_AND_ILC_INIT_128
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5550
#undef SEL_AND_ILC_INIT_256
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5551
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5552
        static flip = 0;
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5553
        int i;
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5554
        for (i = 0; i < nilcs; i++) {
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5555
           if (sel == sel_and_ilc[i].sel) {
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5556
                pIlc = &sel_and_ilc[i].ilc;
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5557
                goto perform2_send_and_return;
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5558
           }       
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5559
        }
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5560
        /*printf("Object >> #perform: #%s with: with: --> no PIC found\n", __symbolVal(aSelector));*/
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5561
        pIlc = &sel_and_ilc[flip].ilc;
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5562
        sel_and_ilc[flip].sel = sel;
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5563
        flip = (flip + 1) % nilcs;
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5564
        pIlc->ilc_func = __SEND2ADDR__;
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5565
        if (pIlc->ilc_poly) {
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5566
             __flushPolyCache(pIlc->ilc_poly);
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5567
            pIlc->ilc_poly = 0;
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5568
        }
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5569
perform2_send_and_return:
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5570
        RETURN ( (*(pIlc->ilc_func))(self, aSelector, nil, pIlc, arg1, arg2) );
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5571
    } else {
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5572
        static struct inlineCache ilc2 = __DUMMYILCSELF2(@line+1);
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5573
        RETURN (_SEND2(self, aSelector, nil, &ilc2, arg1, arg2));
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5574
    }
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5575
%}.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5576
    ^ self perform:aSelector withArguments:(Array with:arg1 with:arg2)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5577
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5578
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5579
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5580
perform:aSelector with:arg1 with:arg2 with:arg3
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5581
    "send the three-arg-message aSelector to the receiver"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5582
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5583
%{
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5584
    struct inlineCache *pIlc;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5585
    static struct inlineCache ilc_0 = __ILCPERF3(@line);
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5586
    static struct inlineCache ilc_1 = __ILCPERF3(@line);
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5587
    static OBJ last_0 = nil;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5588
    static OBJ last_1 = nil;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5589
    static flip = 0;
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
    if (InterruptPending == nil) {
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5592
        if (aSelector != last_0) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5593
            if (aSelector != last_1) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5594
                if (flip) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5595
                    pIlc = &ilc_0;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5596
                    flip = 0;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5597
                    last_0 = aSelector;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5598
                } else {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5599
                    pIlc = &ilc_1;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5600
                    flip = 1;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5601
                    last_1 = aSelector;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5602
                }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5603
                pIlc->ilc_func = __SEND3ADDR__;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5604
                if (pIlc->ilc_poly) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5605
                    __flushPolyCache(pIlc->ilc_poly);
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5606
                    pIlc->ilc_poly = 0;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5607
                }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5608
            } else {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5609
                pIlc = &ilc_1;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5610
            }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5611
        } else {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5612
            pIlc = &ilc_0;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5613
        }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5614
        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
  5615
    } else {
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5616
        static struct inlineCache ilc3 = __DUMMYILCSELF3(@line+1);
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5617
        RETURN (_SEND3(self, aSelector, nil, &ilc3, arg1, arg2, arg3));
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5618
    }
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5619
%}.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5620
    ^ self perform:aSelector withArguments:(Array with:arg1 with:arg2 with:arg3)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5621
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5622
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5623
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5624
perform:aSelector with:arg1 with:arg2 with:arg3 with:arg4
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5625
    "send the four-arg-message aSelector to the receiver"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5626
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5627
%{
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5628
    struct inlineCache *pIlc;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5629
    static struct inlineCache ilc_0 = __ILCPERF4(@line);
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5630
    static struct inlineCache ilc_1 = __ILCPERF4(@line);
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5631
    static OBJ last_0 = nil;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5632
    static OBJ last_1 = nil;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5633
    static flip = 0;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5634
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5635
    if (InterruptPending == nil) {
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5636
        if (aSelector != last_0) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5637
            if (aSelector != last_1) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5638
                if (flip) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5639
                    pIlc = &ilc_0;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5640
                    flip = 0;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5641
                    last_0 = aSelector;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5642
                } else {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5643
                    pIlc = &ilc_1;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5644
                    flip = 1;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5645
                    last_1 = aSelector;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5646
                }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5647
                pIlc->ilc_func = __SEND4ADDR__;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5648
                if (pIlc->ilc_poly) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5649
                    __flushPolyCache(pIlc->ilc_poly);
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5650
                    pIlc->ilc_poly = 0;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5651
                }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5652
            } else {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5653
                pIlc = &ilc_1;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5654
            }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5655
        } else {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5656
            pIlc = &ilc_0;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5657
        }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5658
        RETURN ( (*(pIlc->ilc_func))(self, aSelector, nil, pIlc,
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5659
                                     arg1, arg2, arg3, arg4) );
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5660
    } else {
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5661
        static struct inlineCache ilc4 = __DUMMYILCSELF4(@line+1);
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5662
        RETURN (_SEND4(self, aSelector, nil, &ilc4,
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5663
                       arg1, arg2, arg3, arg4));
5755
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
    ^ 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
  5667
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5668
!
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
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
  5671
    "send the five-arg-message aSelector to the receiver"
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
%{
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5674
    struct inlineCache *pIlc;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5675
    static struct inlineCache ilc_0 = __ILCPERF5(@line);
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5676
    static struct inlineCache ilc_1 = __ILCPERF5(@line);
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5677
    static OBJ last_0 = nil;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5678
    static OBJ last_1 = nil;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5679
    static flip = 0;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5680
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5681
    if (InterruptPending == nil) {
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5682
        if (aSelector != last_0) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5683
            if (aSelector != last_1) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5684
                if (flip) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5685
                    pIlc = &ilc_0;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5686
                    flip = 0;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5687
                    last_0 = aSelector;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5688
                } else {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5689
                    pIlc = &ilc_1;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5690
                    flip = 1;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5691
                    last_1 = aSelector;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5692
                }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5693
                pIlc->ilc_func = __SEND5ADDR__;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5694
                if (pIlc->ilc_poly) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5695
                    __flushPolyCache(pIlc->ilc_poly);
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5696
                    pIlc->ilc_poly = 0;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5697
                }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5698
            } else {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5699
                pIlc = &ilc_1;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5700
            }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5701
        } else {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5702
            pIlc = &ilc_0;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5703
        }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5704
        RETURN ( (*(pIlc->ilc_func))(self, aSelector, nil, pIlc,
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5705
                                     arg1, arg2, arg3, arg4, arg5) );
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5706
    } else {
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5707
        static struct inlineCache ilc5 = __DUMMYILCSELF5(@line+1);
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5708
        RETURN (_SEND5(self, aSelector, nil, &ilc5,
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5709
                       arg1, arg2, arg3, arg4, arg5));
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5710
    }
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5711
%}.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5712
    ^ self perform:aSelector withArguments:(Array with:arg1 with:arg2 with:arg3 with:arg4
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5713
                                                  with:arg5)
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5714
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5715
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5716
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5717
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
  5718
    "send the six-arg-message aSelector to the receiver"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5719
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
    struct inlineCache *pIlc;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5722
    static struct inlineCache ilc_0 = __ILCPERF6(@line);
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5723
    static struct inlineCache ilc_1 = __ILCPERF6(@line);
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5724
    static OBJ last_0 = nil;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5725
    static OBJ last_1 = nil;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5726
    static flip = 0;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5727
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5728
    if (InterruptPending == nil) {
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5729
        if (aSelector != last_0) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5730
            if (aSelector != last_1) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5731
                if (flip) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5732
                    pIlc = &ilc_0;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5733
                    flip = 0;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5734
                    last_0 = aSelector;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5735
                } else {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5736
                    pIlc = &ilc_1;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5737
                    flip = 1;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5738
                    last_1 = aSelector;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5739
                }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5740
                pIlc->ilc_func = __SEND6ADDR__;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5741
                if (pIlc->ilc_poly) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5742
                    __flushPolyCache(pIlc->ilc_poly);
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5743
                    pIlc->ilc_poly = 0;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5744
                }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5745
            } else {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5746
                pIlc = &ilc_1;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5747
            }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5748
        } else {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5749
            pIlc = &ilc_0;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5750
        }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5751
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5752
        RETURN ( (*(pIlc->ilc_func))(self, aSelector, nil, pIlc,
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5753
                                     arg1, arg2, arg3, arg4, arg5, arg6) );
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5754
    } else {
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5755
        static struct inlineCache ilc6 = __DUMMYILCSELF6(@line+1);
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5756
        RETURN (_SEND6(self, aSelector, nil, &ilc6,
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5757
                       arg1, arg2, arg3, arg4, arg5, arg6));
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5758
    }
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5759
%}.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5760
    ^ self perform:aSelector withArguments:(Array with:arg1 with:arg2 with:arg3 with:arg4
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5761
                                                  with:arg5 with:arg6)
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5762
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5763
!
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
perform:aSelector withArguments:argArray
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  5766
    "send the message aSelector with all args taken from argArray
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5767
     to the receiver."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5768
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5769
    |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
  5770
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5771
%{
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5772
    REGISTER OBJ *argP;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5773
    int nargs;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5774
    OBJ l;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5775
8934
32a063645991 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8930
diff changeset
  5776
    if (__isArrayLike(argArray)) {
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5777
        nargs = __arraySize(argArray);
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5778
        argP = __arrayVal(argArray);
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5779
    } else {
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5780
        if (__isNonNilObject(argArray)) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5781
            static struct inlineCache ilcSize = __ILC0(@line);
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5782
            int i;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5783
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5784
            numberOfArgs = (*ilcSize.ilc_func)(argArray, @symbol(size), nil, &ilcSize);
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5785
            if (!__isSmallInteger(numberOfArgs))
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5786
                goto bad;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5787
            nargs = __intVal(numberOfArgs);
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5788
            argP = (OBJ *)(&a1);
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5789
            for (i=1; i <= nargs; i++) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5790
                *argP++ = __AT_(argArray, __mkSmallInteger(i));
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5791
            }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5792
            argP = (OBJ *)(&a1);
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5793
        } else {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5794
            nargs = 0;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5795
        }
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5796
    }
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5797
    switch (nargs) {
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5798
        case 0:
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5799
            if (InterruptPending == nil) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5800
                static OBJ last0_0 = nil; static struct inlineCache ilc0_0 = __ILCPERF0(@line);
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5801
                static OBJ last0_1 = nil; static struct inlineCache ilc0_1 = __ILCPERF0(@line);
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5802
                static OBJ last0_2 = nil; static struct inlineCache ilc0_2 = __ILCPERF0(@line);
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5803
                static OBJ last0_3 = nil; static struct inlineCache ilc0_3 = __ILCPERF0(@line);
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5804
                static int flip0 = 0;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5805
                struct inlineCache *pIlc;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5806
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5807
                if (aSelector == last0_0) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5808
                    pIlc = &ilc0_0;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5809
                } else if (aSelector == last0_1) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5810
                    pIlc = &ilc0_1;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5811
                } else if (aSelector == last0_2) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5812
                    pIlc = &ilc0_2;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5813
                } else if (aSelector == last0_3) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5814
                    pIlc = &ilc0_3;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5815
                } else {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5816
                    if (flip0 == 0) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5817
                        pIlc = &ilc0_0;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5818
                        flip0 = 1;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5819
                        last0_0 = aSelector;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5820
                    } else if (flip0 == 1) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5821
                        pIlc = &ilc0_1;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5822
                        flip0 = 2;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5823
                        last0_1 = aSelector;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5824
                    } else if (flip0 == 2) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5825
                        pIlc = &ilc0_2;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5826
                        flip0 = 3;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5827
                        last0_2 = aSelector;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5828
                    } else {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5829
                        pIlc = &ilc0_3;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5830
                        flip0 = 0;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5831
                        last0_3 = aSelector;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5832
                    }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5833
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5834
                    pIlc->ilc_func = __SEND0ADDR__;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5835
                    if (pIlc->ilc_poly) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5836
                        __flushPolyCache(pIlc->ilc_poly);
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5837
                        pIlc->ilc_poly = 0;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5838
                    }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5839
                }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5840
                RETURN ((*pIlc->ilc_func)(self, aSelector, nil, pIlc));
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5841
            } else {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5842
                static struct inlineCache ilc0 = __DUMMYILCSELF0(@line+1);
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5843
                RETURN (_SEND0(self, aSelector, nil, &ilc0));
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5844
            }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5846
        case 1:
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5847
            if (InterruptPending == nil) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5848
                static OBJ last1_0 = nil; static struct inlineCache ilc1_0 = __ILCPERF1(@line);
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5849
                static OBJ last1_1 = nil; static struct inlineCache ilc1_1 = __ILCPERF1(@line);
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5850
                static OBJ last1_2 = nil; static struct inlineCache ilc1_2 = __ILCPERF1(@line);
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5851
                static OBJ last1_3 = nil; static struct inlineCache ilc1_3 = __ILCPERF1(@line);
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5852
                static int flip1 = 0;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5853
                struct inlineCache *pIlc;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5854
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5855
                if (aSelector == last1_0) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5856
                    pIlc = &ilc1_0;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5857
                } else if (aSelector == last1_1) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5858
                    pIlc = &ilc1_1;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5859
                } else if (aSelector == last1_2) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5860
                    pIlc = &ilc1_2;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5861
                } else if (aSelector == last1_3) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5862
                    pIlc = &ilc1_3;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5863
                } else {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5864
                    if (flip1 == 0) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5865
                        pIlc = &ilc1_0;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5866
                        flip1 = 1;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5867
                        last1_0 = aSelector;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5868
                    } else if (flip1 == 1) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5869
                        pIlc = &ilc1_1;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5870
                        flip1 = 2;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5871
                        last1_1 = aSelector;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5872
                    } else if (flip1 == 2) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5873
                        pIlc = &ilc1_2;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5874
                        flip1 = 3;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5875
                        last1_2 = aSelector;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5876
                    } else {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5877
                        pIlc = &ilc1_3;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5878
                        flip1 = 0;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5879
                        last1_3 = aSelector;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5880
                    }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5881
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5882
                    pIlc->ilc_func = __SEND1ADDR__;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5883
                    if (pIlc->ilc_poly) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5884
                        __flushPolyCache(pIlc->ilc_poly);
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5885
                        pIlc->ilc_poly = 0;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5886
                    }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5887
                }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5888
                RETURN ((*pIlc->ilc_func)(self, aSelector, nil, pIlc, argP[0]));
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5889
            } else {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5890
                static struct inlineCache ilc1 = __DUMMYILCSELF1(@line+1);
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5891
                RETURN (_SEND1(self, aSelector, nil, &ilc1, argP[0]));
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5892
            }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5893
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5894
        case 2:
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5895
            if (InterruptPending == nil) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5896
                static OBJ last2_0 = nil; static struct inlineCache ilc2_0 = __ILCPERF2(@line);
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5897
                static OBJ last2_1 = nil; static struct inlineCache ilc2_1 = __ILCPERF2(@line);
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5898
                static int flip2 = 0;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5899
                struct inlineCache *pIlc;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5900
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5901
                if (aSelector == last2_0) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5902
                    pIlc = &ilc2_0;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5903
                } else if (aSelector == last2_1) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5904
                    pIlc = &ilc2_1;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5905
                } else {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5906
                    if (flip2 == 0) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5907
                        pIlc = &ilc2_0;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5908
                        flip2 = 1;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5909
                        last2_0 = aSelector;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5910
                    } else {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5911
                        pIlc = &ilc2_1;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5912
                        flip2 = 0;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5913
                        last2_1 = aSelector;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5914
                    }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5915
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5916
                    pIlc->ilc_func = __SEND2ADDR__;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5917
                    if (pIlc->ilc_poly) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5918
                        __flushPolyCache(pIlc->ilc_poly);
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5919
                        pIlc->ilc_poly = 0;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5920
                    }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5921
                }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5922
                RETURN ((*pIlc->ilc_func)(self, aSelector, nil, pIlc, argP[0], argP[1]));
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5923
            } else {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5924
                static struct inlineCache ilc2 = __DUMMYILCSELF2(@line+1);
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5925
                RETURN (_SEND2(self, aSelector, nil, &ilc2, argP[0], argP[1]));
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5926
            }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5927
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5928
        case 3:
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5929
            if (InterruptPending == nil) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5930
                static OBJ last3_0 = nil; static struct inlineCache ilc3_0 = __ILCPERF3(@line);
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5931
                static OBJ last3_1 = nil; static struct inlineCache ilc3_1 = __ILCPERF3(@line);
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5932
                static int flip3 = 0;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5933
                struct inlineCache *pIlc;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5934
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5935
                if (aSelector == last3_0) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5936
                    pIlc = &ilc3_0;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5937
                } else if (aSelector == last3_1) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5938
                    pIlc = &ilc3_1;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5939
                } else {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5940
                    if (flip3 == 0) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5941
                        pIlc = &ilc3_0;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5942
                        flip3 = 1;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5943
                        last3_0 = aSelector;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5944
                    } else {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5945
                        pIlc = &ilc3_1;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5946
                        flip3 = 0;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5947
                        last3_1 = aSelector;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5948
                    }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5949
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5950
                    pIlc->ilc_func = __SEND3ADDR__;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5951
                    if (pIlc->ilc_poly) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5952
                        __flushPolyCache(pIlc->ilc_poly);
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5953
                        pIlc->ilc_poly = 0;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5954
                    }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5955
                }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5956
                RETURN ((*pIlc->ilc_func)(self, aSelector, nil, pIlc, argP[0], argP[1], argP[2]));
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5957
            } else {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5958
                static struct inlineCache ilc3 = __DUMMYILCSELF3(@line+1);
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5959
                RETURN (_SEND3(self, aSelector, nil, &ilc3, argP[0], argP[1], argP[2]));
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5960
            }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5961
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5962
        case 4:
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5963
            {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5964
                static OBJ last4 = nil; static struct inlineCache ilc4 = __ILCPERF4(@line);
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5965
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5966
                if ((InterruptPending != nil) || (aSelector != last4)) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5967
                    ilc4.ilc_func = __SEND4ADDR__;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5968
                    if (ilc4.ilc_poly) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5969
                        __flushPolyCache(ilc4.ilc_poly);
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5970
                        ilc4.ilc_poly = 0;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5971
                    }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5972
                    last4 = aSelector;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5973
                }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5974
                RETURN ( (*ilc4.ilc_func)(self, aSelector, nil, &ilc4,
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5975
                                                argP[0], argP[1], argP[2], argP[3]));
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5976
            }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5977
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5978
        case 5:
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5979
            {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5980
                static OBJ last5 = nil; static struct inlineCache ilc5 = __ILCPERF5(@line);
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5981
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5982
                if ((InterruptPending != nil) || (aSelector != last5)) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5983
                    ilc5.ilc_func = __SEND5ADDR__;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5984
                    if (ilc5.ilc_poly) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5985
                        __flushPolyCache(ilc5.ilc_poly);
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5986
                        ilc5.ilc_poly = 0;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5987
                    }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5988
                    last5 = aSelector;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5989
                }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5990
                RETURN ( (*ilc5.ilc_func)(self, aSelector, nil, &ilc5,
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5991
                                                argP[0], argP[1], argP[2], argP[3], argP[4]));
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5992
            }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5993
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5994
        case 6:
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5995
            {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5996
                static OBJ last6 = nil; static struct inlineCache ilc6 = __ILCPERF6(@line);
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5997
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5998
                if ((InterruptPending != nil) || (aSelector != last6)) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  5999
                    ilc6.ilc_func = __SEND6ADDR__;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6000
                    if (ilc6.ilc_poly) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6001
                        __flushPolyCache(ilc6.ilc_poly);
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6002
                        ilc6.ilc_poly = 0;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6003
                    }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6004
                    last6 = aSelector;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6005
                }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6006
                RETURN ( (*ilc6.ilc_func)(self, aSelector, nil, &ilc6,
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6007
                                                argP[0], argP[1], argP[2], argP[3], argP[4],
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6008
                                                argP[5]));
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6009
            }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6010
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6011
        case 7:
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6012
            {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6013
                static OBJ last7 = nil; static struct inlineCache ilc7 = __ILCPERF7(@line);
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6014
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6015
                if ((InterruptPending != nil) || (aSelector != last7)) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6016
                    ilc7.ilc_func = __SEND7ADDR__;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6017
                    if (ilc7.ilc_poly) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6018
                        __flushPolyCache(ilc7.ilc_poly);
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6019
                        ilc7.ilc_poly = 0;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6020
                    }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6021
                    last7 = aSelector;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6022
                }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6023
                RETURN ( (*ilc7.ilc_func)(self, aSelector, nil, &ilc7,
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6024
                                                argP[0], argP[1], argP[2], argP[3], argP[4],
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6025
                                                argP[5], argP[6]));
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6026
            }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6027
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6028
        case 8:
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6029
            {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6030
                static OBJ last8 = nil; static struct inlineCache ilc8 = __ILCPERF8(@line);
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6031
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6032
                if ((InterruptPending != nil) || (aSelector != last8)) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6033
                    ilc8.ilc_func = __SEND8ADDR__;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6034
                    if (ilc8.ilc_poly) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6035
                        __flushPolyCache(ilc8.ilc_poly);
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6036
                        ilc8.ilc_poly = 0;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6037
                    }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6038
                    last8 = aSelector;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6039
                }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6040
                RETURN ( (*ilc8.ilc_func)(self, aSelector, nil, &ilc8,
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6041
                                                argP[0], argP[1], argP[2], argP[3], argP[4],
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6042
                                                argP[5], argP[6], argP[7]));
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6043
            }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6044
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6045
        case 9:
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6046
            {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6047
                static OBJ last9 = nil; static struct inlineCache ilc9 = __ILCPERF9(@line);
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6048
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6049
                if ((InterruptPending != nil) || (aSelector != last9)) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6050
                    ilc9.ilc_func = __SEND9ADDR__;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6051
                    if (ilc9.ilc_poly) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6052
                        __flushPolyCache(ilc9.ilc_poly);
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6053
                        ilc9.ilc_poly = 0;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6054
                    }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6055
                    last9 = aSelector;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6056
                }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6057
                RETURN ( (*ilc9.ilc_func)(self, aSelector, nil, &ilc9,
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6058
                                                argP[0], argP[1], argP[2], argP[3], argP[4],
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6059
                                                argP[5], argP[6], argP[7], argP[8]));
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6060
            }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6061
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6062
        case 10:
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6063
            {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6064
                static OBJ last10 = nil; static struct inlineCache ilc10 = __ILCPERF10(@line);
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6065
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6066
                if ((InterruptPending != nil) || (aSelector != last10)) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6067
                    ilc10.ilc_func = __SEND10ADDR__;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6068
                    if (ilc10.ilc_poly) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6069
                        __flushPolyCache(ilc10.ilc_poly);
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6070
                        ilc10.ilc_poly = 0;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6071
                    }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6072
                    last10 = aSelector;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6073
                }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6074
                RETURN ( (*ilc10.ilc_func)(self, aSelector, nil, &ilc10,
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6075
                                                argP[0], argP[1], argP[2], argP[3], argP[4],
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6076
                                                argP[5], argP[6], argP[7], argP[8], argP[9]));
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6077
            }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6078
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6079
        case 11:
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6080
            {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6081
                static OBJ last11 = nil; static struct inlineCache ilc11 = __ILCPERF11(@line);
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6082
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6083
                if ((InterruptPending != nil) || (aSelector != last11)) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6084
                    ilc11.ilc_func = __SEND11ADDR__;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6085
                    if (ilc11.ilc_poly) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6086
                        __flushPolyCache(ilc11.ilc_poly);
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6087
                        ilc11.ilc_poly = 0;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6088
                    }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6089
                    last11 = aSelector;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6090
                }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6091
                RETURN ( (*ilc11.ilc_func)(self, aSelector, nil, &ilc11,
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6092
                                                argP[0], argP[1], argP[2], argP[3], argP[4],
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6093
                                                argP[5], argP[6], argP[7], argP[8], argP[9],
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6094
                                                argP[10]));
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6095
            }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6096
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6097
        case 12:
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6098
            {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6099
                static OBJ last12 = nil; static struct inlineCache ilc12 = __ILCPERF12(@line);
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6100
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6101
                if ((InterruptPending != nil) || (aSelector != last12)) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6102
                    ilc12.ilc_func = __SEND12ADDR__;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6103
                    if (ilc12.ilc_poly) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6104
                        __flushPolyCache(ilc12.ilc_poly);
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6105
                        ilc12.ilc_poly = 0;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6106
                    }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6107
                    last12 = aSelector;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6108
                }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6109
                RETURN ( (*ilc12.ilc_func)(self, aSelector, nil, &ilc12,
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6110
                                                argP[0], argP[1], argP[2], argP[3], argP[4],
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6111
                                                argP[5], argP[6], argP[7], argP[8], argP[9],
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6112
                                                argP[10], argP[11]));
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6113
            }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6114
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6115
        case 13:
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6116
            {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6117
                static OBJ last13 = nil; static struct inlineCache ilc13 = __ILCPERF13(@line);
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6118
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6119
                if ((InterruptPending != nil) || (aSelector != last13)) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6120
                    ilc13.ilc_func = __SEND13ADDR__;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6121
                    if (ilc13.ilc_poly) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6122
                        __flushPolyCache(ilc13.ilc_poly);
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6123
                        ilc13.ilc_poly = 0;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6124
                    }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6125
                    last13 = aSelector;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6126
                }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6127
                RETURN ( (*ilc13.ilc_func)(self, aSelector, nil, &ilc13,
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6128
                                                argP[0], argP[1], argP[2], argP[3], argP[4],
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6129
                                                argP[5], argP[6], argP[7], argP[8], argP[9],
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6130
                                                argP[10], argP[11], argP[12]));
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6131
            }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6132
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6133
        case 14:
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6134
            {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6135
                static OBJ last14 = nil; static struct inlineCache ilc14 = __ILCPERF14(@line);
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6136
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6137
                if ((InterruptPending != nil) || (aSelector != last14)) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6138
                    ilc14.ilc_func = __SEND14ADDR__;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6139
                    if (ilc14.ilc_poly) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6140
                        __flushPolyCache(ilc14.ilc_poly);
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6141
                        ilc14.ilc_poly = 0;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6142
                    }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6143
                    last14 = aSelector;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6144
                }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6145
                RETURN ( (*ilc14.ilc_func)(self, aSelector, nil, &ilc14,
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6146
                                                argP[0], argP[1], argP[2], argP[3], argP[4],
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6147
                                                argP[5], argP[6], argP[7], argP[8], argP[9],
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6148
                                                argP[10], argP[11], argP[12], argP[13]));
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6149
            }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6150
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6151
        case 15:
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6152
            {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6153
                static OBJ last15 = nil; static struct inlineCache ilc15 = __ILCPERF15(@line);
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6154
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6155
                if ((InterruptPending != nil) || (aSelector != last15)) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6156
                    ilc15.ilc_func = __SEND15ADDR__;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6157
                    if (ilc15.ilc_poly) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6158
                        __flushPolyCache(ilc15.ilc_poly);
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6159
                        ilc15.ilc_poly = 0;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6160
                    }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6161
                    last15 = aSelector;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6162
                }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6163
                RETURN ( (*ilc15.ilc_func)(self, aSelector, nil, &ilc15,
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6164
                                                argP[0], argP[1], argP[2], argP[3], argP[4],
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6165
                                                argP[5], argP[6], argP[7], argP[8], argP[9],
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6166
                                                argP[10], argP[11], argP[12], argP[13],
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6167
                                                argP[14]));
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6168
            }
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6169
    }
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6170
bad:;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6171
%}.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6172
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6173
    "/ arrive here, if bad number of arguments (too many)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6174
    "/ ST/X (currently) only allows up to 15 method arguments
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6175
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6176
    ^ self primitiveFailed
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6177
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6178
6316
345f36d2fc65 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6263
diff changeset
  6179
perform:aSelector withOptionalArgument:arg
345f36d2fc65 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6263
diff changeset
  6180
    "send aSelector-message to the receiver.
6318
3677d346113a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  6181
     If the message expects an argument, pass arg."
6316
345f36d2fc65 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6263
diff changeset
  6182
345f36d2fc65 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6263
diff changeset
  6183
    aSelector numArgs == 1 ifTrue:[
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6184
        ^ self perform:aSelector with:arg
6316
345f36d2fc65 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6263
diff changeset
  6185
    ].
345f36d2fc65 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6263
diff changeset
  6186
    ^ self perform:aSelector
6319
75252ef51b38 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6318
diff changeset
  6187
75252ef51b38 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6318
diff changeset
  6188
    "
75252ef51b38 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6318
diff changeset
  6189
     |rec sel|
75252ef51b38 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6318
diff changeset
  6190
75252ef51b38 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6318
diff changeset
  6191
     rec := -1.
75252ef51b38 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6318
diff changeset
  6192
     sel := #abs.
75252ef51b38 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6318
diff changeset
  6193
     rec perform:sel withOptionalArgument:2.
75252ef51b38 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6318
diff changeset
  6194
75252ef51b38 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6318
diff changeset
  6195
     sel := #max:.
75252ef51b38 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6318
diff changeset
  6196
     rec perform:sel withOptionalArgument:2.
75252ef51b38 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6318
diff changeset
  6197
    "
6316
345f36d2fc65 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6263
diff changeset
  6198
!
345f36d2fc65 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6263
diff changeset
  6199
6321
8af99331b6e8 #perform:withOptionalArgument:and:
Claus Gittinger <cg@exept.de>
parents: 6319
diff changeset
  6200
perform:aSelector withOptionalArgument:optionalArg1 and:optionalArg2
8af99331b6e8 #perform:withOptionalArgument:and:
Claus Gittinger <cg@exept.de>
parents: 6319
diff changeset
  6201
    "send aSelector-message to the receiver.
6728
a4fc441779dc with 3 OptionalArguments
Claus Gittinger <cg@exept.de>
parents: 6721
diff changeset
  6202
     Depending on the number of arguments the message expects,
a4fc441779dc with 3 OptionalArguments
Claus Gittinger <cg@exept.de>
parents: 6721
diff changeset
  6203
     pass either none, 1, or 2 arguments."
6321
8af99331b6e8 #perform:withOptionalArgument:and:
Claus Gittinger <cg@exept.de>
parents: 6319
diff changeset
  6204
8af99331b6e8 #perform:withOptionalArgument:and:
Claus Gittinger <cg@exept.de>
parents: 6319
diff changeset
  6205
    |numArgs|
8af99331b6e8 #perform:withOptionalArgument:and:
Claus Gittinger <cg@exept.de>
parents: 6319
diff changeset
  6206
8af99331b6e8 #perform:withOptionalArgument:and:
Claus Gittinger <cg@exept.de>
parents: 6319
diff changeset
  6207
    numArgs := aSelector numArgs.
8af99331b6e8 #perform:withOptionalArgument:and:
Claus Gittinger <cg@exept.de>
parents: 6319
diff changeset
  6208
    numArgs == 0 ifTrue:[
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6209
        ^ self perform:aSelector
6321
8af99331b6e8 #perform:withOptionalArgument:and:
Claus Gittinger <cg@exept.de>
parents: 6319
diff changeset
  6210
    ].
8af99331b6e8 #perform:withOptionalArgument:and:
Claus Gittinger <cg@exept.de>
parents: 6319
diff changeset
  6211
    numArgs == 1 ifTrue:[
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6212
        ^ self perform:aSelector with:optionalArg1
6321
8af99331b6e8 #perform:withOptionalArgument:and:
Claus Gittinger <cg@exept.de>
parents: 6319
diff changeset
  6213
    ].
8af99331b6e8 #perform:withOptionalArgument:and:
Claus Gittinger <cg@exept.de>
parents: 6319
diff changeset
  6214
    ^ self perform:aSelector with:optionalArg1 with:optionalArg2.
8af99331b6e8 #perform:withOptionalArgument:and:
Claus Gittinger <cg@exept.de>
parents: 6319
diff changeset
  6215
8af99331b6e8 #perform:withOptionalArgument:and:
Claus Gittinger <cg@exept.de>
parents: 6319
diff changeset
  6216
    "
8af99331b6e8 #perform:withOptionalArgument:and:
Claus Gittinger <cg@exept.de>
parents: 6319
diff changeset
  6217
     |rec sel|
8af99331b6e8 #perform:withOptionalArgument:and:
Claus Gittinger <cg@exept.de>
parents: 6319
diff changeset
  6218
8af99331b6e8 #perform:withOptionalArgument:and:
Claus Gittinger <cg@exept.de>
parents: 6319
diff changeset
  6219
     rec := -1.
8af99331b6e8 #perform:withOptionalArgument:and:
Claus Gittinger <cg@exept.de>
parents: 6319
diff changeset
  6220
     sel := #abs.
8af99331b6e8 #perform:withOptionalArgument:and:
Claus Gittinger <cg@exept.de>
parents: 6319
diff changeset
  6221
     rec perform:sel withOptionalArgument:2.
8af99331b6e8 #perform:withOptionalArgument:and:
Claus Gittinger <cg@exept.de>
parents: 6319
diff changeset
  6222
8af99331b6e8 #perform:withOptionalArgument:and:
Claus Gittinger <cg@exept.de>
parents: 6319
diff changeset
  6223
     sel := #max:.
8af99331b6e8 #perform:withOptionalArgument:and:
Claus Gittinger <cg@exept.de>
parents: 6319
diff changeset
  6224
     rec perform:sel withOptionalArgument:2.
8af99331b6e8 #perform:withOptionalArgument:and:
Claus Gittinger <cg@exept.de>
parents: 6319
diff changeset
  6225
    "
8af99331b6e8 #perform:withOptionalArgument:and:
Claus Gittinger <cg@exept.de>
parents: 6319
diff changeset
  6226
!
8af99331b6e8 #perform:withOptionalArgument:and:
Claus Gittinger <cg@exept.de>
parents: 6319
diff changeset
  6227
6728
a4fc441779dc with 3 OptionalArguments
Claus Gittinger <cg@exept.de>
parents: 6721
diff changeset
  6228
perform:aSelector withOptionalArgument:optionalArg1 and:optionalArg2 and:optionalArg3
a4fc441779dc with 3 OptionalArguments
Claus Gittinger <cg@exept.de>
parents: 6721
diff changeset
  6229
    "send aSelector-message to the receiver.
a4fc441779dc with 3 OptionalArguments
Claus Gittinger <cg@exept.de>
parents: 6721
diff changeset
  6230
     Depending on the number of arguments the message expects,
a4fc441779dc with 3 OptionalArguments
Claus Gittinger <cg@exept.de>
parents: 6721
diff changeset
  6231
     pass either none, 1, 2 or 3 arguments."
a4fc441779dc with 3 OptionalArguments
Claus Gittinger <cg@exept.de>
parents: 6721
diff changeset
  6232
a4fc441779dc with 3 OptionalArguments
Claus Gittinger <cg@exept.de>
parents: 6721
diff changeset
  6233
    |numArgs|
a4fc441779dc with 3 OptionalArguments
Claus Gittinger <cg@exept.de>
parents: 6721
diff changeset
  6234
a4fc441779dc with 3 OptionalArguments
Claus Gittinger <cg@exept.de>
parents: 6721
diff changeset
  6235
    numArgs := aSelector numArgs.
a4fc441779dc with 3 OptionalArguments
Claus Gittinger <cg@exept.de>
parents: 6721
diff changeset
  6236
    numArgs == 0 ifTrue:[
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6237
        ^ self perform:aSelector
6728
a4fc441779dc with 3 OptionalArguments
Claus Gittinger <cg@exept.de>
parents: 6721
diff changeset
  6238
    ].
a4fc441779dc with 3 OptionalArguments
Claus Gittinger <cg@exept.de>
parents: 6721
diff changeset
  6239
    numArgs == 1 ifTrue:[
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6240
        ^ self perform:aSelector with:optionalArg1
6728
a4fc441779dc with 3 OptionalArguments
Claus Gittinger <cg@exept.de>
parents: 6721
diff changeset
  6241
    ].
a4fc441779dc with 3 OptionalArguments
Claus Gittinger <cg@exept.de>
parents: 6721
diff changeset
  6242
    numArgs == 2 ifTrue:[
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6243
        ^ self perform:aSelector with:optionalArg1 with:optionalArg2
6728
a4fc441779dc with 3 OptionalArguments
Claus Gittinger <cg@exept.de>
parents: 6721
diff changeset
  6244
    ].
a4fc441779dc with 3 OptionalArguments
Claus Gittinger <cg@exept.de>
parents: 6721
diff changeset
  6245
    ^ self perform:aSelector with:optionalArg1 with:optionalArg2 with:optionalArg3.
a4fc441779dc with 3 OptionalArguments
Claus Gittinger <cg@exept.de>
parents: 6721
diff changeset
  6246
a4fc441779dc with 3 OptionalArguments
Claus Gittinger <cg@exept.de>
parents: 6721
diff changeset
  6247
    "
a4fc441779dc with 3 OptionalArguments
Claus Gittinger <cg@exept.de>
parents: 6721
diff changeset
  6248
     |rec sel|
a4fc441779dc with 3 OptionalArguments
Claus Gittinger <cg@exept.de>
parents: 6721
diff changeset
  6249
a4fc441779dc with 3 OptionalArguments
Claus Gittinger <cg@exept.de>
parents: 6721
diff changeset
  6250
     rec := -1.
a4fc441779dc with 3 OptionalArguments
Claus Gittinger <cg@exept.de>
parents: 6721
diff changeset
  6251
     sel := #abs.
a4fc441779dc with 3 OptionalArguments
Claus Gittinger <cg@exept.de>
parents: 6721
diff changeset
  6252
     rec perform:sel withOptionalArgument:2.
a4fc441779dc with 3 OptionalArguments
Claus Gittinger <cg@exept.de>
parents: 6721
diff changeset
  6253
a4fc441779dc with 3 OptionalArguments
Claus Gittinger <cg@exept.de>
parents: 6721
diff changeset
  6254
     sel := #max:.
a4fc441779dc with 3 OptionalArguments
Claus Gittinger <cg@exept.de>
parents: 6721
diff changeset
  6255
     rec perform:sel withOptionalArgument:2.
a4fc441779dc with 3 OptionalArguments
Claus Gittinger <cg@exept.de>
parents: 6721
diff changeset
  6256
    "
a4fc441779dc with 3 OptionalArguments
Claus Gittinger <cg@exept.de>
parents: 6721
diff changeset
  6257
!
a4fc441779dc with 3 OptionalArguments
Claus Gittinger <cg@exept.de>
parents: 6721
diff changeset
  6258
6764
c5455cf45678 perform:withOptional*
Claus Gittinger <cg@exept.de>
parents: 6741
diff changeset
  6259
perform:aSelector withOptionalArgument:optionalArg1 and:optionalArg2 and:optionalArg3 and:optionalArg4
c5455cf45678 perform:withOptional*
Claus Gittinger <cg@exept.de>
parents: 6741
diff changeset
  6260
    "send aSelector-message to the receiver.
c5455cf45678 perform:withOptional*
Claus Gittinger <cg@exept.de>
parents: 6741
diff changeset
  6261
     Depending on the number of arguments the message expects,
c5455cf45678 perform:withOptional*
Claus Gittinger <cg@exept.de>
parents: 6741
diff changeset
  6262
     pass either none, 1, 2, 3 or 4 arguments."
c5455cf45678 perform:withOptional*
Claus Gittinger <cg@exept.de>
parents: 6741
diff changeset
  6263
c5455cf45678 perform:withOptional*
Claus Gittinger <cg@exept.de>
parents: 6741
diff changeset
  6264
    |numArgs|
c5455cf45678 perform:withOptional*
Claus Gittinger <cg@exept.de>
parents: 6741
diff changeset
  6265
c5455cf45678 perform:withOptional*
Claus Gittinger <cg@exept.de>
parents: 6741
diff changeset
  6266
    numArgs := aSelector numArgs.
c5455cf45678 perform:withOptional*
Claus Gittinger <cg@exept.de>
parents: 6741
diff changeset
  6267
    numArgs == 0 ifTrue:[
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6268
        ^ self perform:aSelector
6764
c5455cf45678 perform:withOptional*
Claus Gittinger <cg@exept.de>
parents: 6741
diff changeset
  6269
    ].
c5455cf45678 perform:withOptional*
Claus Gittinger <cg@exept.de>
parents: 6741
diff changeset
  6270
    numArgs == 1 ifTrue:[
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6271
        ^ self perform:aSelector with:optionalArg1
6764
c5455cf45678 perform:withOptional*
Claus Gittinger <cg@exept.de>
parents: 6741
diff changeset
  6272
    ].
c5455cf45678 perform:withOptional*
Claus Gittinger <cg@exept.de>
parents: 6741
diff changeset
  6273
    numArgs == 2 ifTrue:[
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6274
        ^ self perform:aSelector with:optionalArg1 with:optionalArg2
6764
c5455cf45678 perform:withOptional*
Claus Gittinger <cg@exept.de>
parents: 6741
diff changeset
  6275
    ].
c5455cf45678 perform:withOptional*
Claus Gittinger <cg@exept.de>
parents: 6741
diff changeset
  6276
    numArgs == 3 ifTrue:[
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6277
        ^ self perform:aSelector with:optionalArg1 with:optionalArg2 with:optionalArg3
6764
c5455cf45678 perform:withOptional*
Claus Gittinger <cg@exept.de>
parents: 6741
diff changeset
  6278
    ].
c5455cf45678 perform:withOptional*
Claus Gittinger <cg@exept.de>
parents: 6741
diff changeset
  6279
    ^ self perform:aSelector with:optionalArg1 with:optionalArg2 with:optionalArg3 with:optionalArg4.
c5455cf45678 perform:withOptional*
Claus Gittinger <cg@exept.de>
parents: 6741
diff changeset
  6280
c5455cf45678 perform:withOptional*
Claus Gittinger <cg@exept.de>
parents: 6741
diff changeset
  6281
    "
c5455cf45678 perform:withOptional*
Claus Gittinger <cg@exept.de>
parents: 6741
diff changeset
  6282
     |rec sel|
c5455cf45678 perform:withOptional*
Claus Gittinger <cg@exept.de>
parents: 6741
diff changeset
  6283
c5455cf45678 perform:withOptional*
Claus Gittinger <cg@exept.de>
parents: 6741
diff changeset
  6284
     rec := -1.
c5455cf45678 perform:withOptional*
Claus Gittinger <cg@exept.de>
parents: 6741
diff changeset
  6285
     sel := #abs.
c5455cf45678 perform:withOptional*
Claus Gittinger <cg@exept.de>
parents: 6741
diff changeset
  6286
     rec perform:sel withOptionalArgument:2.
c5455cf45678 perform:withOptional*
Claus Gittinger <cg@exept.de>
parents: 6741
diff changeset
  6287
c5455cf45678 perform:withOptional*
Claus Gittinger <cg@exept.de>
parents: 6741
diff changeset
  6288
     sel := #max:.
c5455cf45678 perform:withOptional*
Claus Gittinger <cg@exept.de>
parents: 6741
diff changeset
  6289
     rec perform:sel withOptionalArgument:2.
c5455cf45678 perform:withOptional*
Claus Gittinger <cg@exept.de>
parents: 6741
diff changeset
  6290
    "
c5455cf45678 perform:withOptional*
Claus Gittinger <cg@exept.de>
parents: 6741
diff changeset
  6291
!
c5455cf45678 perform:withOptional*
Claus Gittinger <cg@exept.de>
parents: 6741
diff changeset
  6292
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6293
performMethod:aMethod
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6294
    "invoke aMethod on the receiver.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6295
     The method should be a zero-argument method.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6296
     This is a non-object-oriented entry, applying a method
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6297
     in a functional way on a receiver.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6298
     Warning:
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6299
         Take care for the method to be appropriate for the
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6300
         receiver - no checking is done by the VM."
5755
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
    ^ aMethod valueWithReceiver:self arguments:#()
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6303
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6304
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6305
     |mthd|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6306
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6307
     mthd := SmallInteger compiledMethodAt:#negated.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6308
     Transcript showCR:(1 performMethod:mthd)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6309
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6310
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6311
    "BAD USE example:
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6312
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6313
     |mthd|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6314
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6315
     mthd := Point compiledMethodAt:#x.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6316
     Transcript showCR:((1->2) performMethod:mthd)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6317
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6318
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6319
    "Modified: 31.7.1997 / 17:41:50 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6320
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6321
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6322
performMethod:aMethod arguments:argumentArray
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6323
    "invoke aMethod on the receiver, passing an argumentArray.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6324
     The size of the argumentArray should match the number of args
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6325
     expected by the method.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6326
     This is a non-object-oriented entry, applying a method
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6327
     in a functional way on a receiver.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6328
     Warning:
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6329
         Take care for the method to be appropriate for the
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6330
         receiver - no checking is done by the VM."
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6331
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6332
    ^ aMethod valueWithReceiver:self arguments:argumentArray
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6333
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6334
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6335
     |mthd|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6336
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6337
     mthd := SmallInteger compiledMethodAt:#+.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6338
     Transcript showCR:(1 performMethod:mthd arguments:#(2))
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6339
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6340
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6341
    "Created: 31.7.1997 / 17:46:31 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6342
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6343
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6344
performMethod:aMethod with:arg
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6345
    "invoke aMethod on the receiver, passing an argument.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6346
     The method should be a one-argument method.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6347
     This is a non-object-oriented entry, applying a method
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6348
     in a functional way on a receiver.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6349
     Warning:
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6350
         Take care for the method to be appropriate for the
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6351
         receiver - no checking is done by the VM."
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6352
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6353
    ^ aMethod valueWithReceiver:self arguments:(Array with:arg)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6354
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6355
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6356
     |mthd|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6357
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6358
     mthd := SmallInteger compiledMethodAt:#+.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6359
     Transcript showCR:(1 performMethod:mthd with:2)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6360
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6361
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6362
    "Modified: 31.7.1997 / 17:42:32 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6363
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6364
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6365
performMethod:aMethod with:arg1 with:arg2
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6366
    "invoke aMethod on the receiver, passing two arguments.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6367
     The method should be a two-argument method.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6368
     This is a non-object-oriented entry, applying a method
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6369
     in a functional way on a receiver.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6370
     Warning:
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6371
         Take care for the method to be appropriate for the
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6372
         receiver - no checking is done by the VM."
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6373
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6374
    ^ aMethod valueWithReceiver:self arguments:(Array with:arg1 with:arg2)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6375
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6376
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6377
     |mthd arr|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6378
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6379
     arr := Array new:1.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6380
     mthd := Array compiledMethodAt:#basicAt:put:.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6381
     arr performMethod:mthd with:1 with:'foo'.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6382
     Transcript showCR:arr
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6383
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6384
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6385
    "Modified: 31.7.1997 / 17:44:54 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6386
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6387
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6388
performMethod:aMethod with:arg1 with:arg2 with:arg3
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6389
    "invoke aMethod on the receiver, passing three arguments.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6390
     The method should be a three-argument method.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6391
     This is a non-object-oriented entry, applying a method
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6392
     in a functional way on a receiver.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6393
     Warning:
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6394
         Take care for the method to be appropriate for the
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6395
         receiver - no checking is done by the VM."
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6396
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6397
    ^ aMethod valueWithReceiver:self arguments:(Array with:arg1 with:arg2 with:arg3)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6398
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6399
    "Created: 31.7.1997 / 17:45:20 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6400
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6401
10834
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  6402
!Object methodsFor:'object persistency'!
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  6403
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  6404
elementDescriptorFor:anAspectSymbol
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  6405
    "support for persistency:
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  6406
     answer a collection of associations containing the
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  6407
     objects state to be encoded for aspect.
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  6408
     Association key is the instance variable name or access selector,
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  6409
     association value is the contents of the instance variable.
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  6410
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  6411
     The default is to return the contents of all non-nil instance variables"
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  6412
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  6413
    |ret|
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  6414
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  6415
    ret := 0.
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  6416
    anAspectSymbol notNil ifTrue:[
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6417
        ret := self perform:anAspectSymbol ifNotUnderstood:[0].
10834
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  6418
    ].
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  6419
    ret == 0 ifTrue:[
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6420
        ^ self elementDescriptorForNonNilInstanceVariables
10834
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  6421
    ].
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  6422
    ^ ret.
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  6423
!
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  6424
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  6425
elementDescriptorForInstanceVariables
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  6426
    "return all instance variables for visiting/encoding"
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  6427
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  6428
    ^ self elementDescriptorForInstanceVariablesMatching:[:val | true].
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  6429
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  6430
    "
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  6431
      #(1 2 3 nil true symbol) elementDescriptorForInstanceVariables
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  6432
      Dictionary new elementDescriptorForInstanceVariables
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  6433
      (5 @ nil) elementDescriptorForInstanceVariables
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  6434
    "
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  6435
!
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  6436
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  6437
elementDescriptorForInstanceVariablesMatching:aBlock
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  6438
    "return all instance variables which conform to aBlock, for encoding/visiting.
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  6439
     Indexed vars are all included."
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  6440
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  6441
    |instVarNames theClass children
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  6442
     instSize "{ Class: SmallInteger }"
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  6443
     varSize "{ Class: SmallInteger }"|
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  6444
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  6445
    theClass := self class.
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  6446
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  6447
    instSize := theClass instSize.
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  6448
    varSize := theClass isVariable ifTrue:[self basicSize] ifFalse:[0].
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  6449
    children := OrderedCollection new:(instSize + varSize).
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  6450
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  6451
    instVarNames := theClass allInstVarNames.
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  6452
    1 to:instSize do:[:i | |var|
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6453
        var := self instVarAt:i.
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6454
        (aBlock value:var) ifTrue:[
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6455
            children add:((instVarNames at:i) -> var)
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6456
        ]
10834
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  6457
    ].
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  6458
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  6459
    varSize ~~ 0 ifTrue:[
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6460
        1 to:varSize do:[:i |
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6461
            children add:(i -> (self basicAt:i))
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6462
        ]
10834
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  6463
    ].
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  6464
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  6465
    ^ children.
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  6466
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  6467
    "
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  6468
      #(1 2 3 nil true symbol) elementDescriptorForInstanceVariables
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  6469
      Dictionary new elementDescriptorForInstanceVariables
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  6470
      (5 @ nil) elementDescriptorForInstanceVariables
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  6471
    "
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  6472
!
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  6473
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  6474
elementDescriptorForNonNilInstanceVariables
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  6475
    "return all non-nil instance variables for visiting/encoding"
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  6476
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  6477
    ^ self elementDescriptorForInstanceVariablesMatching:[:val | val notNil].
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  6478
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  6479
    "
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  6480
      #(1 2 3 nil true symbol) elementDescriptorForNonNilInstanceVariables
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  6481
      Dictionary new elementDescriptorForNonNilInstanceVariables
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  6482
      (5 @ nil) elementDescriptorForNonNilInstanceVariables
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  6483
    "
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  6484
! !
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  6485
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6486
!Object methodsFor:'printing & storing'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6487
6235
8eacf62c458e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6221
diff changeset
  6488
basicPrintOn:aStream
8eacf62c458e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6221
diff changeset
  6489
    "append the receivers className with an articel to the argument, aStream"
8eacf62c458e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6221
diff changeset
  6490
8eacf62c458e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6221
diff changeset
  6491
    aStream nextPutAll:self classNameWithArticle
8eacf62c458e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6221
diff changeset
  6492
!
8eacf62c458e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6221
diff changeset
  6493
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6494
className
14368
deb662b4664b comment/format in: #className
Claus Gittinger <cg@exept.de>
parents: 14355
diff changeset
  6495
    "return the classname of the receiver's class"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6496
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6497
    ^ self class name
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6498
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6499
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6500
     1 className
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  6501
     1 class className
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6502
     $a className
9105
1666cb465e3f comments
Stefan Vogel <sv@exept.de>
parents: 9071
diff changeset
  6503
     $a class className
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6504
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6505
!
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
classNameWithArticle
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6508
    "return a string consisting of classname preceeded by an article.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6509
     (dont expect me to write national variants for this ... :-)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6510
     If you have special preferences, redefine it ..."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6511
6829
db28715efb4d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6815
diff changeset
  6512
    | cls|
5755
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
    (cls := self class) == self ifTrue:[
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6515
        ^ 'a funny object'
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6516
    ].
14368
deb662b4664b comment/format in: #className
Claus Gittinger <cg@exept.de>
parents: 14355
diff changeset
  6517
    cls isNil ifTrue:[
deb662b4664b comment/format in: #className
Claus Gittinger <cg@exept.de>
parents: 14355
diff changeset
  6518
        ^ 'a nil-classes object'        "/ cannot happen
deb662b4664b comment/format in: #className
Claus Gittinger <cg@exept.de>
parents: 14355
diff changeset
  6519
    ].
6829
db28715efb4d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6815
diff changeset
  6520
    ^ cls nameWithArticle
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6521
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6522
    "
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  6523
     1 classNameWithArticle
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  6524
     (1->2) classNameWithArticle
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6525
     XWorkstation basicNew classNameWithArticle
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  6526
     XWorkstation classNameWithArticle
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6527
    "
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
    "Modified: 13.5.1996 / 12:16:14 / 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
errorPrint
12703
b87cc4993193 changed:
sr
parents: 12566
diff changeset
  6533
    "print the receiver on the Transcript and Stderr.
10530
0f3d3ddd3837 #errorPrint* and #infoPrint* print to Transcript.
Stefan Vogel <sv@exept.de>
parents: 10527
diff changeset
  6534
     The Transcript is directed to the standard error stream on
0f3d3ddd3837 #errorPrint* and #infoPrint* print to Transcript.
Stefan Vogel <sv@exept.de>
parents: 10527
diff changeset
  6535
     headless applications."
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6536
14165
b5bb4e9fde8c changed:
Stefan Vogel <sv@exept.de>
parents: 14162
diff changeset
  6537
    Stderr isNil ifTrue:[
b5bb4e9fde8c changed:
Stefan Vogel <sv@exept.de>
parents: 14162
diff changeset
  6538
        "/ the following allows errorPrint to be used during
b5bb4e9fde8c changed:
Stefan Vogel <sv@exept.de>
parents: 14162
diff changeset
  6539
        "/ the early init-phase, when no Stderr has been set up.
b5bb4e9fde8c changed:
Stefan Vogel <sv@exept.de>
parents: 14162
diff changeset
  6540
        "/ (depends on string to respond to #errorPrint)
b5bb4e9fde8c changed:
Stefan Vogel <sv@exept.de>
parents: 14162
diff changeset
  6541
        self printString errorPrint.
b5bb4e9fde8c changed:
Stefan Vogel <sv@exept.de>
parents: 14162
diff changeset
  6542
        ^ self.
b5bb4e9fde8c changed:
Stefan Vogel <sv@exept.de>
parents: 14162
diff changeset
  6543
    ].
b5bb4e9fde8c changed:
Stefan Vogel <sv@exept.de>
parents: 14162
diff changeset
  6544
13350
8c7603161369 added: #withErrorStreamDo:
Claus Gittinger <cg@exept.de>
parents: 13320
diff changeset
  6545
    self withErrorStreamDo:[:s | self printOn:s].
8c7603161369 added: #withErrorStreamDo:
Claus Gittinger <cg@exept.de>
parents: 13320
diff changeset
  6546
8c7603161369 added: #withErrorStreamDo:
Claus Gittinger <cg@exept.de>
parents: 13320
diff changeset
  6547
    "Modified: / 21-04-2011 / 12:46:42 / cg"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6548
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6549
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6550
errorPrintCR
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6551
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6552
12703
b87cc4993193 changed:
sr
parents: 12566
diff changeset
  6553
    "print the receiver followed by a cr on the error stream(s).
10530
0f3d3ddd3837 #errorPrint* and #infoPrint* print to Transcript.
Stefan Vogel <sv@exept.de>
parents: 10527
diff changeset
  6554
     The Transcript is directed to the standard error stream on
0f3d3ddd3837 #errorPrint* and #infoPrint* print to Transcript.
Stefan Vogel <sv@exept.de>
parents: 10527
diff changeset
  6555
     headless applications."
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6556
14165
b5bb4e9fde8c changed:
Stefan Vogel <sv@exept.de>
parents: 14162
diff changeset
  6557
    Stderr isNil ifTrue:[
b5bb4e9fde8c changed:
Stefan Vogel <sv@exept.de>
parents: 14162
diff changeset
  6558
        "/ the following allows errorPrintCR to be used during
b5bb4e9fde8c changed:
Stefan Vogel <sv@exept.de>
parents: 14162
diff changeset
  6559
        "/ the early init-phase, when no Stderr has been set up.
b5bb4e9fde8c changed:
Stefan Vogel <sv@exept.de>
parents: 14162
diff changeset
  6560
        "/ (depends on string to respond to #errorPrintCR)
b5bb4e9fde8c changed:
Stefan Vogel <sv@exept.de>
parents: 14162
diff changeset
  6561
        self printString errorPrintCR.
b5bb4e9fde8c changed:
Stefan Vogel <sv@exept.de>
parents: 14162
diff changeset
  6562
        ^ self.
b5bb4e9fde8c changed:
Stefan Vogel <sv@exept.de>
parents: 14162
diff changeset
  6563
    ].
b5bb4e9fde8c changed:
Stefan Vogel <sv@exept.de>
parents: 14162
diff changeset
  6564
13350
8c7603161369 added: #withErrorStreamDo:
Claus Gittinger <cg@exept.de>
parents: 13320
diff changeset
  6565
    self withErrorStreamDo:[:s | self printOn:s. s cr].
8c7603161369 added: #withErrorStreamDo:
Claus Gittinger <cg@exept.de>
parents: 13320
diff changeset
  6566
8c7603161369 added: #withErrorStreamDo:
Claus Gittinger <cg@exept.de>
parents: 13320
diff changeset
  6567
    "
8c7603161369 added: #withErrorStreamDo:
Claus Gittinger <cg@exept.de>
parents: 13320
diff changeset
  6568
     'hello' errorPrintCR
8c7603161369 added: #withErrorStreamDo:
Claus Gittinger <cg@exept.de>
parents: 13320
diff changeset
  6569
    "
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6570
10564
7d25403688ba dont errorPrint on Transcript when I am a system process.
Claus Gittinger <cg@exept.de>
parents: 10558
diff changeset
  6571
    "Created: / 20-05-1996 / 10:20:41 / cg"
13350
8c7603161369 added: #withErrorStreamDo:
Claus Gittinger <cg@exept.de>
parents: 13320
diff changeset
  6572
    "Modified: / 21-04-2011 / 12:47:13 / cg"
5755
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
errorPrintNL
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6576
    "{ Pragma: +optSpace }"
5893
f92054b38d3c Assign #obsolete resource to obsolete methods
Stefan Vogel <sv@exept.de>
parents: 5879
diff changeset
  6577
    <resource:#obsolete>
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6578
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6579
    "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
  6580
     Please use #errorPrintCR - this method exists for backward compatibility."
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
    ^ self errorPrintCR
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
    "Modified: 20.5.1996 / 10:24:45 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6585
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6586
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6587
errorPrintNewline
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6588
    "{ Pragma: +optSpace }"
5893
f92054b38d3c Assign #obsolete resource to obsolete methods
Stefan Vogel <sv@exept.de>
parents: 5879
diff changeset
  6589
    <resource:#obsolete>
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6590
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6591
    "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
  6592
     Please use #errorPrintCR - this method exists for backward compatibility."
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
    self errorPrintCR.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6595
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6596
    "Modified: 20.5.1996 / 10:24:38 / 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
infoPrint
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6600
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6601
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6602
    "print the receiver on the standard error stream.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6603
     This is meant for information messages which are not warnings
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6604
     or fatal messages.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6605
     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
  6606
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6607
    InfoPrinting == true ifTrue:[
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6608
        self errorPrint
5755
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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6612
infoPrintCR
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6613
    "{ Pragma: +optSpace }"
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
     This is meant for information messages which are not warnings
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6617
     or fatal messages.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6618
     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
  6619
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6620
    InfoPrinting == true ifTrue:[
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6621
        self errorPrintCR
5755
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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6624
    "Created: 20.5.1996 / 10:21:28 / cg"
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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6627
infoPrintNL
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6628
    "{ Pragma: +optSpace }"
5893
f92054b38d3c Assign #obsolete resource to obsolete methods
Stefan Vogel <sv@exept.de>
parents: 5879
diff changeset
  6629
    <resource:#obsolete>
5755
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
    "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
  6632
     Please use #infoPrintCR - this method exists for backward compatibility."
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
    ^ self infoPrintCR
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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6637
print
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6638
    "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
  6639
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6640
    "/ the following allows printCR to be used during
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6641
    "/ the early init-phase, when no Stdout has been set up.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6642
    "/ (depends on string to respond to #print)
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
    Stdout isNil ifTrue:[
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6645
        self printString print.
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6646
        ^ self
5755
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
    self printOn:Stdout
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
    "Modified: 4.11.1996 / 23:36:58 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6651
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6652
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6653
printCR
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6654
    "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
  6655
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6656
    "/ the following allows printCR to be used during
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6657
    "/ the early init-phase, when no Stdout has been set up.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6658
    "/ (depends on string to respond to #printCR)
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
    Stdout isNil ifTrue:[
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6661
        self printString printCR.
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6662
        ^ self
5755
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
    self printOn:Stdout.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6665
    Stdout cr
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6666
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6667
    "Created: 20.5.1996 / 10:21:37 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6668
    "Modified: 4.11.1996 / 23:37:06 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6669
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6670
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6671
printNL
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6672
    "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
  6673
     This exists for GNU Smalltalk compatibility - please use #printCR."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6674
5893
f92054b38d3c Assign #obsolete resource to obsolete methods
Stefan Vogel <sv@exept.de>
parents: 5879
diff changeset
  6675
    <resource:#obsolete>
f92054b38d3c Assign #obsolete resource to obsolete methods
Stefan Vogel <sv@exept.de>
parents: 5879
diff changeset
  6676
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6677
    ^ self printCR
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6678
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6679
    "Modified: 20.5.1996 / 10:25:31 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6680
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6681
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6682
printNewline
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6683
    "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
  6684
     This exists for backward compatibility - please use #printCR."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6685
5893
f92054b38d3c Assign #obsolete resource to obsolete methods
Stefan Vogel <sv@exept.de>
parents: 5879
diff changeset
  6686
    <resource:#obsolete>
f92054b38d3c Assign #obsolete resource to obsolete methods
Stefan Vogel <sv@exept.de>
parents: 5879
diff changeset
  6687
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6688
    self printCR
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6689
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6690
    "Modified: 20.5.1996 / 10:25:46 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6691
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6692
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6693
printOn:aStream
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6694
    "append a user printed representation of the receiver to aStream.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6695
     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
  6696
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6697
     The default here is to output the receivers class name.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6698
     BUT: this method is heavily redefined for objects which
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6699
     can print prettier."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6700
6235
8eacf62c458e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6221
diff changeset
  6701
    self basicPrintOn:aStream.
8eacf62c458e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6221
diff changeset
  6702
8eacf62c458e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6221
diff changeset
  6703
   "
8eacf62c458e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6221
diff changeset
  6704
    (1@2) printOn:Transcript
8eacf62c458e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6221
diff changeset
  6705
    (1@2) basicPrintOn:Transcript
8eacf62c458e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6221
diff changeset
  6706
   "
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6707
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6708
11068
a5ef673886fd #printOn:format: and #printStringFormat for Date/Time compatibility
Stefan Vogel <sv@exept.de>
parents: 11065
diff changeset
  6709
printOn:aStream format:format
11335
c061d08b766f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11314
diff changeset
  6710
    "this may be redefined in subclasses.
11068
a5ef673886fd #printOn:format: and #printStringFormat for Date/Time compatibility
Stefan Vogel <sv@exept.de>
parents: 11065
diff changeset
  6711
     Defined here for compatibility with subclasses"
a5ef673886fd #printOn:format: and #printStringFormat for Date/Time compatibility
Stefan Vogel <sv@exept.de>
parents: 11065
diff changeset
  6712
a5ef673886fd #printOn:format: and #printStringFormat for Date/Time compatibility
Stefan Vogel <sv@exept.de>
parents: 11065
diff changeset
  6713
    self printOn:aStream.
a5ef673886fd #printOn:format: and #printStringFormat for Date/Time compatibility
Stefan Vogel <sv@exept.de>
parents: 11065
diff changeset
  6714
!
a5ef673886fd #printOn:format: and #printStringFormat for Date/Time compatibility
Stefan Vogel <sv@exept.de>
parents: 11065
diff changeset
  6715
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6716
printOn:aStream leftPaddedTo:size
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6717
    "print the receiver on aStream, padding with spaces up to size.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6718
     padding is done on the left."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6719
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6720
    self printOn:aStream leftPaddedTo:size with:(Character space)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6721
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6722
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6723
     123 printOn:Transcript leftPaddedTo:10. Transcript cr
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6724
     123 printOn:Transcript leftPaddedTo:2. Transcript cr
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6725
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6726
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6727
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6728
printOn:aStream leftPaddedTo:size with:padCharacter
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6729
    "print the receiver on aStream, padding with padCharacters up to size.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6730
     padding is done on the left."
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
    aStream nextPutAll:(self printStringLeftPaddedTo:size with:padCharacter)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6733
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6734
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6735
     123 printOn:Transcript leftPaddedTo:10 with:$_ . Transcript cr
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6736
     123 printOn:Transcript leftPaddedTo:10 with:$. . Transcript cr
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6737
    "
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
printOn:aStream paddedTo:size
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6741
    "print the receiver on aStream, padding with spaces up to size."
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
    self printOn:aStream paddedTo:size with:(Character space)
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
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6746
     123.0 printOn:Transcript paddedTo:10. Transcript nextPut:$|. Transcript cr
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6747
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6748
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6749
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6750
printOn:aStream paddedTo:size with:padCharacter
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6751
    "print the receiver on aStream, padding with padCharacter up to size"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6752
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6753
    aStream nextPutAll:(self printStringPaddedTo:size with:padCharacter).
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
     123 printOn:Transcript paddedTo:10 with:$_ . Transcript cr
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6757
     123 printOn:Transcript paddedTo:10 with:$. . Transcript cr
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6758
    "
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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6761
printOn:aStream zeroPaddedTo:size
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6762
    "print the receiver on aStream, padding with zeros up to size.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6763
     Usually used with float numbers."
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
    self printOn:aStream paddedTo:size with:$0.
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
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6768
     123.0 printOn:Transcript zeroPaddedTo:10
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
!
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
printRightAdjustLen:size
11068
a5ef673886fd #printOn:format: and #printStringFormat for Date/Time compatibility
Stefan Vogel <sv@exept.de>
parents: 11065
diff changeset
  6773
    <resource: #obsolete>
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6774
    "obsolete - just a name confusion.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6775
     This method will go away ..."
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
    (self printStringLeftPaddedTo:size) printOn:Stdout
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6778
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6779
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6780
printString
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6781
    "return a string for printing the receiver.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6782
     Since we now use printOn: as the basic print mechanism,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6783
     we have to create a stream and print into it."
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
    |s|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6786
11790
6dcd44bc2ff9 Larger default for #printString
Stefan Vogel <sv@exept.de>
parents: 11738
diff changeset
  6787
    s := CharacterWriteStream on:(String basicNew:40).     "allocate at least 46 bytes for fast UUID conversion"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6788
    self printOn:s.
8300
d15ead94361f Use CharacterWriteStream in #printString (speedup)
Stefan Vogel <sv@exept.de>
parents: 8287
diff changeset
  6789
    ^ s contents.
7978
4ce7575e1cfc care for 16bit chars in #printString
Claus Gittinger <cg@exept.de>
parents: 7838
diff changeset
  6790
4ce7575e1cfc care for 16bit chars in #printString
Claus Gittinger <cg@exept.de>
parents: 7838
diff changeset
  6791
    "
4ce7575e1cfc care for 16bit chars in #printString
Claus Gittinger <cg@exept.de>
parents: 7838
diff changeset
  6792
     Date today printString.
4ce7575e1cfc care for 16bit chars in #printString
Claus Gittinger <cg@exept.de>
parents: 7838
diff changeset
  6793
    "
5755
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
11068
a5ef673886fd #printOn:format: and #printStringFormat for Date/Time compatibility
Stefan Vogel <sv@exept.de>
parents: 11065
diff changeset
  6796
printStringFormat:orintFormat
a5ef673886fd #printOn:format: and #printStringFormat for Date/Time compatibility
Stefan Vogel <sv@exept.de>
parents: 11065
diff changeset
  6797
    "subclasses may redefine this.
a5ef673886fd #printOn:format: and #printStringFormat for Date/Time compatibility
Stefan Vogel <sv@exept.de>
parents: 11065
diff changeset
  6798
     Defined here to avoid type checks"
a5ef673886fd #printOn:format: and #printStringFormat for Date/Time compatibility
Stefan Vogel <sv@exept.de>
parents: 11065
diff changeset
  6799
a5ef673886fd #printOn:format: and #printStringFormat for Date/Time compatibility
Stefan Vogel <sv@exept.de>
parents: 11065
diff changeset
  6800
    ^ self printString
a5ef673886fd #printOn:format: and #printStringFormat for Date/Time compatibility
Stefan Vogel <sv@exept.de>
parents: 11065
diff changeset
  6801
!
a5ef673886fd #printOn:format: and #printStringFormat for Date/Time compatibility
Stefan Vogel <sv@exept.de>
parents: 11065
diff changeset
  6802
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6803
printStringLeftPaddedTo:size
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6804
    "return my printString as a right-adjusted string of length size;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6805
     characters on the left are filled with spaces.
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  6806
     If the printString is longer than size,
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6807
     it is returned unchanged (i.e. not truncated)"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6808
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6809
    ^ self printStringLeftPaddedTo:size with:(Character space)
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
     10 printStringLeftPaddedTo:10
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6813
     1 printStringLeftPaddedTo:10
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6814
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6815
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6816
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6817
printStringLeftPaddedTo:size ifLarger:alternative
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6818
    "return my printString as a right-adjusted string of length size;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6819
     characters on the left are filled with spaces.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6820
     If the printString is larger than size,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6821
     return the result from evaluating alternative."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6822
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6823
    ^ self printStringLeftPaddedTo:size with:(Character space) ifLarger:alternative
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
     12   printStringLeftPaddedTo:3 ifLarger:['***']
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6827
     123  printStringLeftPaddedTo:3 ifLarger:['***']
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6828
     1234 printStringLeftPaddedTo:3 ifLarger:['***']
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6829
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6830
!
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
printStringLeftPaddedTo:size with:padCharacter
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6833
    "return my printString as a right-adjusted string of length size;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6834
     characters on the left are filled with padCharacter.
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  6835
     If the printString is longer than size,
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6836
     it is returned unchanged (i.e. not truncated)"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6837
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6838
    ^ (self printString) leftPaddedTo:size with:padCharacter
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
    "
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  6841
     123 printStringLeftPaddedTo:10 with:$.
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  6842
     1 printStringLeftPaddedTo:10 with:$.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6843
     (Float pi) printStringLeftPaddedTo:20 with:$*
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6844
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6845
!
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
printStringLeftPaddedTo:size with:padCharacter ifLarger:alternative
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6848
    "return my printString as a right-adjusted string of length size;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6849
     characters on the left are filled with padCharacter.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6850
     If the printString is larger than size,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6851
     return the result from evaluating alternative."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6852
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6853
    |s|
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
    s := self printString.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6856
    s size > size ifTrue:[^ alternative value].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6857
    ^ s leftPaddedTo:size with:padCharacter
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6858
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6859
    "
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  6860
     12   printStringLeftPaddedTo:3 with:$. ifLarger:['***']
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  6861
     123  printStringLeftPaddedTo:3 with:$. ifLarger:['***']
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  6862
     1234 printStringLeftPaddedTo:3 with:$. ifLarger:['***']
5755
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
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6865
8576
f58f51583a34 +printStringLimitedTo:
Claus Gittinger <cg@exept.de>
parents: 8574
diff changeset
  6866
printStringLimitedTo:sizeLimit
f58f51583a34 +printStringLimitedTo:
Claus Gittinger <cg@exept.de>
parents: 8574
diff changeset
  6867
    "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
  6868
f58f51583a34 +printStringLimitedTo:
Claus Gittinger <cg@exept.de>
parents: 8574
diff changeset
  6869
    |s|
f58f51583a34 +printStringLimitedTo:
Claus Gittinger <cg@exept.de>
parents: 8574
diff changeset
  6870
f58f51583a34 +printStringLimitedTo:
Claus Gittinger <cg@exept.de>
parents: 8574
diff changeset
  6871
    s := CharacterWriteStream on:(String basicNew:30).
f58f51583a34 +printStringLimitedTo:
Claus Gittinger <cg@exept.de>
parents: 8574
diff changeset
  6872
    s writeLimit:sizeLimit.
f58f51583a34 +printStringLimitedTo:
Claus Gittinger <cg@exept.de>
parents: 8574
diff changeset
  6873
    self printOn:s.
f58f51583a34 +printStringLimitedTo:
Claus Gittinger <cg@exept.de>
parents: 8574
diff changeset
  6874
    ^ s contents.
f58f51583a34 +printStringLimitedTo:
Claus Gittinger <cg@exept.de>
parents: 8574
diff changeset
  6875
f58f51583a34 +printStringLimitedTo:
Claus Gittinger <cg@exept.de>
parents: 8574
diff changeset
  6876
    "
f58f51583a34 +printStringLimitedTo:
Claus Gittinger <cg@exept.de>
parents: 8574
diff changeset
  6877
     Date today printStringLimitedTo:5.
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  6878
     '12345678901234567890' printStringLimitedTo:5.
8576
f58f51583a34 +printStringLimitedTo:
Claus Gittinger <cg@exept.de>
parents: 8574
diff changeset
  6879
    "
f58f51583a34 +printStringLimitedTo:
Claus Gittinger <cg@exept.de>
parents: 8574
diff changeset
  6880
!
f58f51583a34 +printStringLimitedTo:
Claus Gittinger <cg@exept.de>
parents: 8574
diff changeset
  6881
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6882
printStringOnError:exceptionBlock
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6883
    "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
  6884
     evaluating exceptionBlock. Useful to print something in an exceptionHandler or other
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6885
     cleanup code."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6886
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6887
    |rslt|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6888
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6889
    Error handle:[:ex |
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6890
        rslt := exceptionBlock value
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6891
    ] do:[
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  6892
        rslt := self printString
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6893
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6894
    ^ rslt
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6895
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6896
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6897
printStringPaddedTo:size
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6898
    "return a printed representation of the receiver,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6899
     padded with spaces (at the right) up to size.
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  6900
     If the printString is longer than size,
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6901
     it is returned unchanged (i.e. not truncated)"
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
    ^ self printStringPaddedTo:size with:(Character space)
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
    "
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  6906
     123 printStringPaddedTo:10
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  6907
     1234567890123456 printStringPaddedTo:10
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  6908
     'hello' printStringPaddedTo:10
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6909
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6910
!
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
printStringPaddedTo:size ifLarger:alternative
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6913
    "return a printed representation of the receiver,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6914
     padded with spaces (at the right) up to size.
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  6915
     If the resulting printString is too large,
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6916
     return the result from evaluating alternative."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6917
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6918
    ^ self printStringPaddedTo:size with:(Character space) ifLarger:alternative
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
    "
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  6921
     12   printStringPaddedTo:3 ifLarger:['***']
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  6922
     123  printStringPaddedTo:3 ifLarger:['***']
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  6923
     1234 printStringPaddedTo:3 ifLarger:['***']
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6924
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6925
!
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
printStringPaddedTo:size with:padCharacter
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6928
    "return a printed representation of the receiver,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6929
     padded with padCharacter (at the right) up to size.
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  6930
     If the printString is longer than size,
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6931
     it is returned unchanged (i.e. not truncated)"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6932
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6933
    ^ (self printString) paddedTo:size with:padCharacter
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
     123  printStringPaddedTo:10 with:$.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6937
     123  printStringPaddedTo:10 with:$*
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  6938
     123  printStringPaddedTo:3 with:$*
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  6939
     1234 printStringPaddedTo:3 with:$*
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6940
    "
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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6943
printStringPaddedTo:size with:padCharacter ifLarger:alternative
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6944
    "return a printed representation of the receiver,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6945
     padded with padCharacter (at the right) up to size.
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  6946
     If the resulting printString is too large,
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6947
     return the result from evaluating alternative."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6948
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6949
    |s|
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
    s := self printString.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6952
    s size > size ifTrue:[^ alternative value].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6953
    ^ s paddedTo:size with:padCharacter
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6954
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6955
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6956
     123   printStringPaddedTo:3 with:$. ifLarger:['***']
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6957
     12345 printStringPaddedTo:3 with:$. ifLarger:['***']
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6958
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6959
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6960
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6961
printStringRightAdjustLen:size
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6962
    "obsolete - just a name confusion.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6963
     This method will go away ..."
11068
a5ef673886fd #printOn:format: and #printStringFormat for Date/Time compatibility
Stefan Vogel <sv@exept.de>
parents: 11065
diff changeset
  6964
    <resource: #obsolete>
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6965
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6966
    ^ self printStringLeftPaddedTo:size
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
printStringZeroPaddedTo:size
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  6970
    "return a printed representation of the receiver,
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6971
     padded with zero (at the right) characters up to size.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6972
     Usually used with float numbers."
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 printStringPaddedTo:size with:$0
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
    "
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  6977
     123.0 printStringZeroPaddedTo:10
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6978
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6979
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6980
8287
9770f4ad54ff +printfPrintString
werner
parents: 8273
diff changeset
  6981
printfPrintString:ignoredFormat
9770f4ad54ff +printfPrintString
werner
parents: 8273
diff changeset
  6982
    "fallback to default printString
9770f4ad54ff +printfPrintString
werner
parents: 8273
diff changeset
  6983
     (for compatibility with float and integer-printing)"
9770f4ad54ff +printfPrintString
werner
parents: 8273
diff changeset
  6984
9770f4ad54ff +printfPrintString
werner
parents: 8273
diff changeset
  6985
    ^ self printString
9770f4ad54ff +printfPrintString
werner
parents: 8273
diff changeset
  6986
!
9770f4ad54ff +printfPrintString
werner
parents: 8273
diff changeset
  6987
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6988
store
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6989
    "store the receiver on standard output.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6990
     this method is useless, but included for compatibility."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6991
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6992
    self storeOn:Stdout
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6993
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6994
7600
5a3fee21c032 #storeString - omit # from Symbols and Arrays that are elements of an array.
Stefan Vogel <sv@exept.de>
parents: 7576
diff changeset
  6995
storeArrayElementOn:aStream
5a3fee21c032 #storeString - omit # from Symbols and Arrays that are elements of an array.
Stefan Vogel <sv@exept.de>
parents: 7576
diff changeset
  6996
    "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
  6997
     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
  6998
5a3fee21c032 #storeString - omit # from Symbols and Arrays that are elements of an array.
Stefan Vogel <sv@exept.de>
parents: 7576
diff changeset
  6999
    ^ 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
  7000
!
5a3fee21c032 #storeString - omit # from Symbols and Arrays that are elements of an array.
Stefan Vogel <sv@exept.de>
parents: 7576
diff changeset
  7001
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7002
storeCR
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7003
    "store the receiver on standard output; append a carriage return."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7004
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7005
    self store.
11068
a5ef673886fd #printOn:format: and #printStringFormat for Date/Time compatibility
Stefan Vogel <sv@exept.de>
parents: 11065
diff changeset
  7006
    Stdout cr.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7007
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7008
    "Created: 20.5.1996 / 10:26:01 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7009
    "Modified: 20.5.1996 / 10:26:57 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7010
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7011
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7012
storeNl
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7013
    "store the receiver on standard output; append a newline.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7014
     This method is included for backward compatibility-  use #storeCR."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7015
5893
f92054b38d3c Assign #obsolete resource to obsolete methods
Stefan Vogel <sv@exept.de>
parents: 5879
diff changeset
  7016
    <resource:#obsolete>
f92054b38d3c Assign #obsolete resource to obsolete methods
Stefan Vogel <sv@exept.de>
parents: 5879
diff changeset
  7017
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7018
    self storeCR.
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
    "Modified: 20.5.1996 / 10:26:49 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7021
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7022
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7023
storeOn:aStream
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7024
    "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
  7025
     reconstruct the receiver.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7026
     Notice, that no self referencing or cyclic objects can be represented
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7027
     in this format.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7028
     Use storeBinaryOn:, which handles these cases correctly."
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
    |myClass hasSemi sz "{ Class: SmallInteger }" |
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7031
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7032
    thisContext isRecursive ifTrue:[
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7033
        Object recursiveStoreStringSignal raiseRequestWith:self.
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7034
        'Object [error]: storeString of self referencing object (' errorPrint.
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7035
        self class name errorPrint.
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7036
        ')' errorPrintCR.
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7037
        aStream nextPutAll:'#("recursive")'.
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7038
        ^ self
5755
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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7041
    myClass := self class.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7042
    aStream nextPut:$(.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7043
    aStream nextPutAll:self class name.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7044
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7045
    hasSemi := false.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7046
    myClass isVariable ifTrue:[
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7047
        aStream nextPutAll:' basicNew:'.
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7048
        self basicSize printOn:aStream
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7049
    ] ifFalse:[
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7050
        aStream nextPutAll:' basicNew'
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7051
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7052
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7053
    sz := myClass instSize.
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  7054
    1 to:sz do:[:i |
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7055
        aStream nextPutAll:' instVarAt:'.
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7056
        i printOn:aStream.
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7057
        aStream nextPutAll:' put:'.
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7058
        (self instVarAt:i) storeOn:aStream.
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7059
        aStream nextPut:$;.
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7060
        hasSemi := true
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7061
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7062
    myClass isVariable ifTrue:[
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7063
        sz := self basicSize.
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7064
        1 to:sz do:[:i |
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7065
            aStream nextPutAll:' basicAt:'.
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7066
            i printOn:aStream.
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7067
            aStream nextPutAll:' put:'.
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7068
            (self basicAt:i) storeOn:aStream.
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7069
            aStream nextPut:$;.
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7070
            hasSemi := true
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7071
        ]
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7072
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7073
    hasSemi ifTrue:[
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7074
        aStream nextPutAll:' yourself'
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7075
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7076
    aStream nextPut:$).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7077
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7078
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7079
     |s|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7080
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7081
     s := WriteStream on:(String new).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7082
     ('hello' -> 'world') storeOn:s.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7083
     s := ReadStream on:(s contents).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7084
     (Object readFrom:s) inspect
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7085
    "
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|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7088
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7089
     s := 'data' asFilename writeStream.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7090
     ('hello' -> 'world') storeOn:s.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7091
     s close.
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 := 'data' asFilename readStream.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7094
     (Object readFrom:s) inspect
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7095
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7096
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7097
    "does not work example:"
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 a|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7100
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7101
     a := Array new:2.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7102
     a at:1 put:a.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7103
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7104
     s := 'data' asFilename writeStream.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7105
     a storeOn:s.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7106
     s close.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7107
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7108
     s := 'data' asFilename readStream.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7109
     (Object readFrom:s) inspect
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7110
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7111
13162
dd688290df14 changed: #storeOn:
Claus Gittinger <cg@exept.de>
parents: 13140
diff changeset
  7112
    "Modified: / 03-12-2010 / 13:27:51 / cg"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7113
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7114
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7115
storeString
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7116
    "return a string representing an expression to reconstruct the receiver.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7117
     Notice, that no self referencing or cyclic objects can be represented
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7118
     in this format.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7119
     Use storeBinaryOn:, which handles these cases correctly."
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
    |s|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7122
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7123
    s := WriteStream on:(String new:50).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7124
    self storeOn:s.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7125
    ^ s contents
13350
8c7603161369 added: #withErrorStreamDo:
Claus Gittinger <cg@exept.de>
parents: 13320
diff changeset
  7126
!
8c7603161369 added: #withErrorStreamDo:
Claus Gittinger <cg@exept.de>
parents: 13320
diff changeset
  7127
8c7603161369 added: #withErrorStreamDo:
Claus Gittinger <cg@exept.de>
parents: 13320
diff changeset
  7128
withErrorStreamDo:aBlock
8c7603161369 added: #withErrorStreamDo:
Claus Gittinger <cg@exept.de>
parents: 13320
diff changeset
  7129
    "{ Pragma: +optSpace }"
8c7603161369 added: #withErrorStreamDo:
Claus Gittinger <cg@exept.de>
parents: 13320
diff changeset
  7130
14162
79def684ccac changed: #withErrorStreamDo:
Stefan Vogel <sv@exept.de>
parents: 14079
diff changeset
  7131
    "helper for error messages - evaluate aBlock, passing it a stream on which to put
13350
8c7603161369 added: #withErrorStreamDo:
Claus Gittinger <cg@exept.de>
parents: 13320
diff changeset
  7132
     error messages."
8c7603161369 added: #withErrorStreamDo:
Claus Gittinger <cg@exept.de>
parents: 13320
diff changeset
  7133
13578
aa9827cafc2c signalInterrupt: - tell which process was killed
Claus Gittinger <cg@exept.de>
parents: 13566
diff changeset
  7134
    |stream|
aa9827cafc2c signalInterrupt: - tell which process was killed
Claus Gittinger <cg@exept.de>
parents: 13566
diff changeset
  7135
aa9827cafc2c signalInterrupt: - tell which process was killed
Claus Gittinger <cg@exept.de>
parents: 13566
diff changeset
  7136
    stream := Processor activeProcess isSystemProcess
13500
51b2e6c6c2ac changed:
Claus Gittinger <cg@exept.de>
parents: 13488
diff changeset
  7137
                        ifTrue:[Stderr]
51b2e6c6c2ac changed:
Claus Gittinger <cg@exept.de>
parents: 13488
diff changeset
  7138
                        ifFalse:[Transcript].
13350
8c7603161369 added: #withErrorStreamDo:
Claus Gittinger <cg@exept.de>
parents: 13320
diff changeset
  7139
    StreamError catch:[
13578
aa9827cafc2c signalInterrupt: - tell which process was killed
Claus Gittinger <cg@exept.de>
parents: 13566
diff changeset
  7140
        aBlock value:stream.
aa9827cafc2c signalInterrupt: - tell which process was killed
Claus Gittinger <cg@exept.de>
parents: 13566
diff changeset
  7141
    ].
14162
79def684ccac changed: #withErrorStreamDo:
Stefan Vogel <sv@exept.de>
parents: 14079
diff changeset
  7142
    stream ~~ Stderr ifTrue:[
13578
aa9827cafc2c signalInterrupt: - tell which process was killed
Claus Gittinger <cg@exept.de>
parents: 13566
diff changeset
  7143
        aBlock value:Stderr.
13350
8c7603161369 added: #withErrorStreamDo:
Claus Gittinger <cg@exept.de>
parents: 13320
diff changeset
  7144
    ].
8c7603161369 added: #withErrorStreamDo:
Claus Gittinger <cg@exept.de>
parents: 13320
diff changeset
  7145
8c7603161369 added: #withErrorStreamDo:
Claus Gittinger <cg@exept.de>
parents: 13320
diff changeset
  7146
    "Created: / 21-04-2011 / 12:46:21 / cg"
5755
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
!Object methodsFor:'queries'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7150
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7151
basicSize
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7152
    "return the number of the receivers indexed instance variables,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7153
     0 if it has none.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7154
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7155
     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
  7156
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7157
%{  /* NOCONTEXT */
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7158
8909
485a8e3153e0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  7159
    REGISTER INT nbytes;
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7160
    REGISTER OBJ myClass;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7161
    int nInstBytes;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7162
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7163
    /*
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7164
     * notice the missing test for self being a nonNilObject -
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7165
     * this can be done since basicSize is defined both in UndefinedObject
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7166
     * and SmallInteger
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7167
     */
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7168
    myClass = __qClass(self);
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7169
    nbytes = __qSize(self);
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7170
    nInstBytes = OHDR_SIZE + __OBJS2BYTES__( __intVal(__ClassInstPtr(myClass)->c_ninstvars) );
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7171
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7172
    switch ((INT)(__ClassInstPtr(myClass)->c_flags) & __MASKSMALLINT(ARRAYMASK)) {
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7173
        case __MASKSMALLINT(POINTERARRAY):
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7174
        case __MASKSMALLINT(WKPOINTERARRAY):
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7175
            nbytes -= nInstBytes;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7176
            RETURN ( __mkSmallInteger(__BYTES2OBJS__(nbytes)) );
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7177
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7178
        case __MASKSMALLINT(BYTEARRAY):
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7179
            nbytes -= nInstBytes;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7180
            RETURN ( __mkSmallInteger(nbytes / sizeof(char)) );
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7181
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7182
        case __MASKSMALLINT(FLOATARRAY):
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7183
            nbytes -= nInstBytes;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7184
            RETURN ( __mkSmallInteger(nbytes / sizeof(float)) );
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7185
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7186
        case __MASKSMALLINT(DOUBLEARRAY):
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7187
#ifdef __NEED_DOUBLE_ALIGN
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7188
            nInstBytes = (nInstBytes-1+__DOUBLE_ALIGN) &~ (__DOUBLE_ALIGN-1);
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7189
#endif
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7190
            nbytes -= nInstBytes;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7191
            RETURN ( __mkSmallInteger(nbytes / sizeof(double)) );
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7192
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7193
        case __MASKSMALLINT(WORDARRAY):
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7194
        case __MASKSMALLINT(SWORDARRAY):
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7195
            nbytes -= nInstBytes;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7196
            RETURN ( __mkSmallInteger(nbytes>>1) ); /* notice the hardcoded 2 here - not sizeof(short) */
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7197
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7198
        case __MASKSMALLINT(LONGARRAY):
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7199
        case __MASKSMALLINT(SLONGARRAY):
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7200
            nbytes -= nInstBytes;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7201
            RETURN ( __mkSmallInteger(nbytes>>2) ); /* notice the hardcoded 4 here - not sizeof(int) */
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7202
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7203
        case __MASKSMALLINT(LONGLONGARRAY):
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7204
        case __MASKSMALLINT(SLONGLONGARRAY):
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7205
#ifdef __NEED_LONGLONG_ALIGN
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7206
            nInstBytes = (nInstBytes-1+__LONGLONG_ALIGN) &~ (__LONGLONG_ALIGN-1);
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7207
#endif
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7208
            nbytes -= nInstBytes;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7209
            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
  7210
    }
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7211
%}.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7212
    ^ 0
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7213
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7214
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7215
byteSize
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7216
    "return the number of bytes in the receivers indexed instance variables,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7217
     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
  7218
     instvars i.e. byteArrays, wordArrays etc.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7219
     Notice: for Strings the returned size may look strange.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7220
     Only useful with binary storage."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7221
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7222
    |myClass|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7223
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7224
    myClass := self class.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7225
    myClass isVariable ifTrue:[
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7226
        myClass isPointers ifFalse:[
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7227
            myClass isBytes ifTrue:[
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7228
                ^ self basicSize.
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7229
            ].
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7230
            myClass isWords ifTrue:[
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7231
                ^ self basicSize * 2.
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7232
            ].
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7233
            myClass isSignedWords ifTrue:[
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7234
                ^ self basicSize * 2.
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7235
            ].
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7236
            myClass isLongs ifTrue:[
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7237
                ^ self basicSize * 4.
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7238
            ].
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7239
            myClass isSignedLongs ifTrue:[
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7240
                ^ self basicSize * 4.
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7241
            ].
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7242
            myClass isLongLongs ifTrue:[
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7243
                ^ self basicSize * 8.
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7244
            ].
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7245
            myClass isSignedLongLongs ifTrue:[
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7246
                ^ self basicSize * 8.
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7247
            ].
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7248
            myClass isFloats ifTrue:[
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7249
                ^ self basicSize * (ExternalBytes sizeofFloat)
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7250
            ].
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7251
            myClass isDoubles ifTrue:[
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7252
                ^ self basicSize * (ExternalBytes sizeofDouble)
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7253
            ].
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7254
            self error:'unknown variable size class species'.
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7255
        ]
5755
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
    ^ 0
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
    "
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  7260
     Point new byteSize
14078
2d03d221276f comment/format in: #byteSize
Stefan Vogel <sv@exept.de>
parents: 14056
diff changeset
  7261
     'hello' byteSize      
2d03d221276f comment/format in: #byteSize
Stefan Vogel <sv@exept.de>
parents: 14056
diff changeset
  7262
     'hello' asUnicode16String byteSize      
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  7263
     (ByteArray with:1 with:2) byteSize
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  7264
     (FloatArray with:1.5) byteSize
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  7265
     (DoubleArray with:1.5) byteSize
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  7266
     (WordArray with:1 with:2) byteSize
5755
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
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7269
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7270
class
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7271
    "return the receivers class"
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
%{  /* NOCONTEXT */
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7274
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7275
    RETURN ( __Class(self) );
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7276
%}
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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7279
respondsTo:aSelector
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7280
    "return true, if the receiver implements a method with selector equal
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7281
     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
  7282
     receivers class or one of its superclasses.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7283
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7284
     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
  7285
     an error being raised. For example, an implementation could send
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7286
     #shouldNotImplement or #subclassResponsibility."
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
     should we go via the cache, or search (by class) ?
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7290
     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
  7291
     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
  7292
     For now, use the cache ...
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
%{  /* NOCONTEXT */
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7295
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7296
    if (__lookup(__Class(self), aSelector) == nil) {
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7297
        RETURN ( false );
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7298
    }
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7299
    RETURN ( true );
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
.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7302
    ^ self class canUnderstand:aSelector
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7303
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
    "'aString' respondsTo:#+"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7306
    "'aString' respondsTo:#,"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7307
    "'aString' respondsTo:#collect:"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7308
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7309
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7310
respondsToArithmetic
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7311
    "return true, if the receiver responds to arithmetic messages.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7312
     false is returned here - the method is redefined in ArithmeticValue."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7313
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7314
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7315
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7316
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7317
size
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7318
    "return the number of the receivers indexed instance variables;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7319
     this method may be redefined in subclasses"
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
    ^ self basicSize
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7322
!
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
species
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7325
    "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
  7326
     This is used to create an appropriate object when creating derived
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7327
     copies in the collection classes (sometimes redefined)."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7328
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7329
    ^ self class
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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7332
yourself
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7333
    "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
  7334
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7335
    ^ self
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
14296
fe82bc5091f9 added: #isUUID
Stefan Vogel <sv@exept.de>
parents: 14292
diff changeset
  7338
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7339
!Object methodsFor:'secure message sending'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7340
13099
fdcece3bda6c added: #?:
Claus Gittinger <cg@exept.de>
parents: 13039
diff changeset
  7341
?: selector
fdcece3bda6c added: #?:
Claus Gittinger <cg@exept.de>
parents: 13039
diff changeset
  7342
    "try to send a message to the receiver;
fdcece3bda6c added: #?:
Claus Gittinger <cg@exept.de>
parents: 13039
diff changeset
  7343
     if understood, return the value;
fdcece3bda6c added: #?:
Claus Gittinger <cg@exept.de>
parents: 13039
diff changeset
  7344
     if not, return nil."
fdcece3bda6c added: #?:
Claus Gittinger <cg@exept.de>
parents: 13039
diff changeset
  7345
fdcece3bda6c added: #?:
Claus Gittinger <cg@exept.de>
parents: 13039
diff changeset
  7346
    ^ self perform:selector ifNotUnderstood:nil
fdcece3bda6c added: #?:
Claus Gittinger <cg@exept.de>
parents: 13039
diff changeset
  7347
fdcece3bda6c added: #?:
Claus Gittinger <cg@exept.de>
parents: 13039
diff changeset
  7348
    "
fdcece3bda6c added: #?:
Claus Gittinger <cg@exept.de>
parents: 13039
diff changeset
  7349
     ApplicationModel new masterApplication resources first             - error
fdcece3bda6c added: #?:
Claus Gittinger <cg@exept.de>
parents: 13039
diff changeset
  7350
     ApplicationModel new ?: #masterApplication ?: #resources ?: #first - nil
fdcece3bda6c added: #?:
Claus Gittinger <cg@exept.de>
parents: 13039
diff changeset
  7351
    "
fdcece3bda6c added: #?:
Claus Gittinger <cg@exept.de>
parents: 13039
diff changeset
  7352
fdcece3bda6c added: #?:
Claus Gittinger <cg@exept.de>
parents: 13039
diff changeset
  7353
    "Modified: / 20-10-2010 / 10:45:21 / cg"
fdcece3bda6c added: #?:
Claus Gittinger <cg@exept.de>
parents: 13039
diff changeset
  7354
!
fdcece3bda6c added: #?:
Claus Gittinger <cg@exept.de>
parents: 13039
diff changeset
  7355
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7356
askFor:aSelector
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7357
    "try to send the receiver the message, aSelector.
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  7358
     If it does not understand it, return false.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7359
     Otherwise the real value returned.
11398
1f006dd241a7 +askFor:with:
Claus Gittinger <cg@exept.de>
parents: 11366
diff changeset
  7360
     Useful to send messages such as: #isColor to unknown receivers."
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
    ^ self perform:aSelector ifNotUnderstood:[false]
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7363
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7364
    "
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  7365
     1 askFor:#isColor
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  7366
     Color red askFor:#isColor
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  7367
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  7368
     1 askFor:#isFoo
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  7369
     Color red askFor:#isFoo
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7370
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7371
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7372
11398
1f006dd241a7 +askFor:with:
Claus Gittinger <cg@exept.de>
parents: 11366
diff changeset
  7373
askFor:aSelector with:argument
1f006dd241a7 +askFor:with:
Claus Gittinger <cg@exept.de>
parents: 11366
diff changeset
  7374
    "try to send the receiver the message, aSelector.
1f006dd241a7 +askFor:with:
Claus Gittinger <cg@exept.de>
parents: 11366
diff changeset
  7375
     If it does not understand it, return false.
1f006dd241a7 +askFor:with:
Claus Gittinger <cg@exept.de>
parents: 11366
diff changeset
  7376
     Otherwise the real value returned.
1f006dd241a7 +askFor:with:
Claus Gittinger <cg@exept.de>
parents: 11366
diff changeset
  7377
     Useful to send messages such as: #isXXX: to unknown receivers."
1f006dd241a7 +askFor:with:
Claus Gittinger <cg@exept.de>
parents: 11366
diff changeset
  7378
1f006dd241a7 +askFor:with:
Claus Gittinger <cg@exept.de>
parents: 11366
diff changeset
  7379
    ^ self perform:aSelector with:argument ifNotUnderstood:[false]
1f006dd241a7 +askFor:with:
Claus Gittinger <cg@exept.de>
parents: 11366
diff changeset
  7380
!
1f006dd241a7 +askFor:with:
Claus Gittinger <cg@exept.de>
parents: 11366
diff changeset
  7381
11401
78104cb2fba3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11398
diff changeset
  7382
askFor:aSelector with:arg1 with:arg2
78104cb2fba3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11398
diff changeset
  7383
    "try to send the receiver the message, aSelector.
78104cb2fba3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11398
diff changeset
  7384
     If it does not understand it, return false.
78104cb2fba3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11398
diff changeset
  7385
     Otherwise the real value returned.
78104cb2fba3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11398
diff changeset
  7386
     Useful to send messages such as: #isXXX: to unknown receivers."
78104cb2fba3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11398
diff changeset
  7387
78104cb2fba3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11398
diff changeset
  7388
    ^ self perform:aSelector with:arg1 with:arg2 ifNotUnderstood:[false]
78104cb2fba3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11398
diff changeset
  7389
!
78104cb2fba3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11398
diff changeset
  7390
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7391
perform:aSelector ifNotUnderstood:exceptionBlock
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7392
    "try to send message aSelector to the receiver.
12157
114823c8f3b0 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 12050
diff changeset
  7393
     If its understood, return the method's returned value,
114823c8f3b0 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 12050
diff changeset
  7394
     otherwise return the value of the exceptionBlock.
114823c8f3b0 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 12050
diff changeset
  7395
     Read this:
114823c8f3b0 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 12050
diff changeset
  7396
     Many programmers do an Error-handle to perform a similar
114823c8f3b0 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 12050
diff changeset
  7397
     checked-message send. However, this method is more specific,
114823c8f3b0 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 12050
diff changeset
  7398
     in that only errors for the given selector are cought - not any other
114823c8f3b0 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 12050
diff changeset
  7399
     doesNotUnderstand, and especially not any other error."
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7400
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7401
    |val ok|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7402
6146
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
  7403
    MessageNotUnderstood handle:[:ex |
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7404
        "/ reject, if the bad message is not the one
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7405
        "/ we have sent originally
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7406
        (ex selector == aSelector and:[ex receiver == self]) ifFalse:[
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7407
            ex reject
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7408
        ].
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7409
    ] do:[
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7410
        val := self perform:aSelector.
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7411
        ok := true.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7412
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7413
    ok isNil ifTrue:[
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7414
        ^ exceptionBlock value
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7415
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7416
    ^ val
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7417
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7418
    "
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  7419
     1.2345 perform:#foo ifNotUnderstood:['sorry']
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  7420
     1.2345 perform:#sqrt ifNotUnderstood:['sorry']
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  7421
     12345 perform:#sqrt ifNotUnderstood:['sorry']
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7422
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7423
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7424
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7425
perform:aSelector with:argument ifNotUnderstood:exceptionBlock
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7426
    "try to send message aSelector to the receiver.
12157
114823c8f3b0 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 12050
diff changeset
  7427
     If its understood, return the method's returned value,
114823c8f3b0 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 12050
diff changeset
  7428
     otherwise return the value of the exceptionBlock.
114823c8f3b0 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 12050
diff changeset
  7429
     Read this:
114823c8f3b0 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 12050
diff changeset
  7430
     Many programmers do an Error-handle to perform a similar
114823c8f3b0 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 12050
diff changeset
  7431
     checked-message send. However, this method is more specific,
114823c8f3b0 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 12050
diff changeset
  7432
     in that only errors for the given selector are cought - not any other
114823c8f3b0 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 12050
diff changeset
  7433
     doesNotUnderstand, and especially not any other error."
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7434
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7435
    |val ok|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7436
8939
ac97eb450b97 Fix examples in #perform:*ifNotUnderstood:
Stefan Vogel <sv@exept.de>
parents: 8935
diff changeset
  7437
    MessageNotUnderstood handle:[:ex |
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7438
        "/ reject, if the bad message is not the one
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7439
        "/ we have sent originally
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7440
        (ex selector == aSelector and:[ex receiver == self]) ifFalse:[
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7441
            ex reject
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7442
        ]
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7443
    ] do:[
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7444
        val := self perform:aSelector with:argument.
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7445
        ok := true.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7446
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7447
    ok isNil ifTrue:[
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7448
        ^ exceptionBlock value
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7449
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7450
    ^ val
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7451
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7452
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7453
     |unknown|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7454
8939
ac97eb450b97 Fix examples in #perform:*ifNotUnderstood:
Stefan Vogel <sv@exept.de>
parents: 8935
diff changeset
  7455
     unknown := 4.
ac97eb450b97 Fix examples in #perform:*ifNotUnderstood:
Stefan Vogel <sv@exept.de>
parents: 8935
diff changeset
  7456
     (unknown perform:#- with:2 ifNotUnderstood:['sorry']) printNewline.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7457
     unknown := 'high there'.
8939
ac97eb450b97 Fix examples in #perform:*ifNotUnderstood:
Stefan Vogel <sv@exept.de>
parents: 8935
diff changeset
  7458
     (unknown perform:#- with:2 ifNotUnderstood:['sorry']) printNewline.
5755
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
5926
e5ce56a2bd40 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5912
diff changeset
  7462
perform:aSelector with:arg1 with:arg2 ifNotUnderstood:exceptionBlock
e5ce56a2bd40 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5912
diff changeset
  7463
    "try to send message aSelector to the receiver.
12157
114823c8f3b0 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 12050
diff changeset
  7464
     If its understood, return the method's returned value,
114823c8f3b0 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 12050
diff changeset
  7465
     otherwise return the value of the exceptionBlock.
114823c8f3b0 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 12050
diff changeset
  7466
     Read this:
114823c8f3b0 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 12050
diff changeset
  7467
     Many programmers do an Error-handle to perform a similar
114823c8f3b0 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 12050
diff changeset
  7468
     checked-message send. However, this method is more specific,
114823c8f3b0 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 12050
diff changeset
  7469
     in that only errors for the given selector are cought - not any other
114823c8f3b0 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 12050
diff changeset
  7470
     doesNotUnderstand, and especially not any other error."
5926
e5ce56a2bd40 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5912
diff changeset
  7471
e5ce56a2bd40 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5912
diff changeset
  7472
    |val ok|
e5ce56a2bd40 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5912
diff changeset
  7473
8939
ac97eb450b97 Fix examples in #perform:*ifNotUnderstood:
Stefan Vogel <sv@exept.de>
parents: 8935
diff changeset
  7474
    MessageNotUnderstood handle:[:ex |
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7475
        "/ reject, if the bad message is not the one
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7476
        "/ we have sent originally
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7477
        (ex selector == aSelector and:[ex receiver == self]) ifFalse:[
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7478
            ex reject
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7479
        ]
5926
e5ce56a2bd40 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5912
diff changeset
  7480
    ] do:[
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7481
        val := self perform:aSelector with:arg1 with:arg2.
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7482
        ok := true.
5926
e5ce56a2bd40 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5912
diff changeset
  7483
    ].
e5ce56a2bd40 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5912
diff changeset
  7484
    ok isNil ifTrue:[
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7485
        ^ exceptionBlock value
5926
e5ce56a2bd40 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5912
diff changeset
  7486
    ].
e5ce56a2bd40 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5912
diff changeset
  7487
    ^ val
e5ce56a2bd40 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5912
diff changeset
  7488
!
e5ce56a2bd40 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5912
diff changeset
  7489
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7490
perform:aSelector withArguments:argumentArray ifNotUnderstood:exceptionBlock
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7491
    "try to send message aSelector to the receiver.
12157
114823c8f3b0 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 12050
diff changeset
  7492
     If its understood, return the method's returned value,
114823c8f3b0 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 12050
diff changeset
  7493
     otherwise return the value of the exceptionBlock.
114823c8f3b0 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 12050
diff changeset
  7494
     Read this:
114823c8f3b0 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 12050
diff changeset
  7495
     Many programmers do an Error-handle to perform a similar
114823c8f3b0 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 12050
diff changeset
  7496
     checked-message send. However, this method is more specific,
114823c8f3b0 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 12050
diff changeset
  7497
     in that only errors for the given selector are cought - not any other
114823c8f3b0 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 12050
diff changeset
  7498
     doesNotUnderstand, and especially not any other error."
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7499
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7500
    |val ok|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7501
8939
ac97eb450b97 Fix examples in #perform:*ifNotUnderstood:
Stefan Vogel <sv@exept.de>
parents: 8935
diff changeset
  7502
    MessageNotUnderstood handle:[:ex |
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7503
        "/ reject, if the bad message is not the one
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7504
        "/ we have sent originally.
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7505
        (ex selector == aSelector and:[ex receiver == self]) ifFalse:[
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7506
            ex reject
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7507
        ]
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7508
    ] do:[
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7509
        val := self perform:aSelector withArguments:argumentArray.
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7510
        ok := true.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7511
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7512
    ok isNil ifTrue:[
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7513
        ^ exceptionBlock value
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7514
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7515
    ^ val
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7516
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7517
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7518
     |unknown|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7519
8939
ac97eb450b97 Fix examples in #perform:*ifNotUnderstood:
Stefan Vogel <sv@exept.de>
parents: 8935
diff changeset
  7520
     unknown := 4.
ac97eb450b97 Fix examples in #perform:*ifNotUnderstood:
Stefan Vogel <sv@exept.de>
parents: 8935
diff changeset
  7521
     (unknown perform:#- withArguments:#(2) ifNotUnderstood:['sorry']) printNewline.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7522
     unknown := 'high there'.
8939
ac97eb450b97 Fix examples in #perform:*ifNotUnderstood:
Stefan Vogel <sv@exept.de>
parents: 8935
diff changeset
  7523
     (unknown perform:#- withArguments:#(2) ifNotUnderstood:['sorry']) printNewline.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7524
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7525
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7526
    "Modified: 27.3.1997 / 14:13:16 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7527
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7528
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7529
!Object methodsFor:'signal constants'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7530
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7531
messageNotUnderstoodSignal
6146
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
  7532
    ^ MessageNotUnderstood
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7533
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7534
    "Created: 6.3.1997 / 15:46:52 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7535
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7536
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7537
!Object methodsFor:'special queries'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7538
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7539
allOwners
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7540
    "return a collection of all objects referencing the receiver"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7541
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7542
    ^ ObjectMemory whoReferences:self
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7543
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7544
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7545
references:anObject
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7546
    "return true, if the receiver refers to the argument, anObject.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7547
     - for debugging only"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7548
6074
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7549
    ^ self referencesObject:anObject
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7550
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7551
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7552
     |v|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7553
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7554
     v := View new initialize.
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  7555
     v references:Display.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7556
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7557
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7558
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7559
referencesAny:aCollection
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  7560
    "return true, if the receiver refers to any object from
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7561
     the argument, aCollection.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7562
     - for debugging only"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7563
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  7564
%{
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7565
    OBJ cls, flags;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7566
    int nInsts, inst;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7567
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7568
    if (! __isNonNilObject(self)) {
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7569
        RETURN (false);
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7570
    }
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7571
8934
32a063645991 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8930
diff changeset
  7572
    if (__isArrayLike(aCollection)) {
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7573
        int nObjs = __arraySize(aCollection);
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7574
        char *minAddr = 0, *maxAddr = 0;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7575
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7576
        if (nObjs == 0) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7577
            RETURN (false);
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7578
        }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7579
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7580
        /*
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7581
         * a little optimization: use the fact that all old objects
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7582
         * refering to a new object are on the remSet; if I am not,
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7583
         * a trivial reject is possible, if all objects are newbees.
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7584
         * as a side effect, gather min/max addresses
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7585
         */
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7586
        if ((__qSpace(self) <= OLDSPACE) && !__isRemembered(self)) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7587
            int allNewBees = 1;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7588
            int i;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7589
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7590
            minAddr = (char *)(__ArrayInstPtr(aCollection)->a_element[0]);
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7591
            maxAddr = minAddr;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7592
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7593
            for (i=0; i<nObjs; i++) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7594
                OBJ anObject;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7595
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7596
                anObject = __ArrayInstPtr(aCollection)->a_element[i];
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7597
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7598
                if (__isNonNilObject(anObject)) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7599
                    int spc;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7600
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7601
                    if (((spc = __qSpace(anObject)) != NEWSPACE) && (spc != SURVSPACE)) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7602
                        allNewBees = 0;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7603
                    }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7604
                }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7605
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7606
                if ((char *)anObject < minAddr) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7607
                    minAddr = (char *)anObject;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7608
                } else if ((char *)anObject > maxAddr) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7609
                    maxAddr = (char *)anObject;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7610
                }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7611
            }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7612
            if (allNewBees) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7613
                RETURN (false);
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7614
            }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7615
        }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7616
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7617
        /*
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7618
         * fetch min/max in searchList (if not already done)
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7619
         */
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7620
        if (minAddr == 0) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7621
            int i;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7622
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7623
            for (i=0; i<nObjs; i++) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7624
                OBJ anObject;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7625
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7626
                anObject = __ArrayInstPtr(aCollection)->a_element[i];
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7627
                if ((char *)anObject < minAddr) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7628
                    minAddr = (char *)anObject;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7629
                } else if ((char *)anObject > maxAddr) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7630
                    maxAddr = (char *)anObject;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7631
                }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7632
            }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7633
        }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7634
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7635
        cls = __qClass(self);
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7636
        if (((char *)cls >= minAddr) && ((char *)cls <= maxAddr)) {
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7637
#if defined(memsrch4)
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7638
            if (memsrch4(__arrayVal(aCollection), (INT)cls, nObjs)) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7639
                RETURN (true);
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7640
            }
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7641
#else
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7642
            int i;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7643
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7644
            for (i=0; i<nObjs; i++) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7645
                OBJ anObject;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7646
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7647
                anObject = __ArrayInstPtr(aCollection)->a_element[i];
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7648
                if (cls == anObject) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7649
                    RETURN (true);
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7650
                }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7651
            }
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7652
#endif /* memsrch4 */
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7653
        }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7654
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7655
        flags = __ClassInstPtr(cls)->c_flags;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7656
        if (((INT)flags & __MASKSMALLINT(ARRAYMASK)) == __MASKSMALLINT(POINTERARRAY)) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7657
            nInsts = __BYTES2OBJS__(__qSize(self) - OHDR_SIZE);
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7658
        } else {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7659
            nInsts = __intVal(__ClassInstPtr(cls)->c_ninstvars);
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7660
        }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7661
        if (! nInsts) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7662
            RETURN (false);
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7663
        }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7664
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7665
        if (nObjs == 1) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7666
            /* better reverse the loop */
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7667
            OBJ anObject;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7668
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7669
            anObject = __ArrayInstPtr(aCollection)->a_element[0];
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7670
#if defined(memsrch4)
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7671
            if (memsrch4(__InstPtr(self)->i_instvars, (INT)anObject, nInsts)) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7672
                RETURN (true);
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7673
            }
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7674
#else
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7675
            for (inst=0; inst<nInsts; inst++) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7676
                if ((__InstPtr(self)->i_instvars[inst]) == anObject) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7677
                    RETURN (true);
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7678
                }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7679
            }
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7680
#endif
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7681
            RETURN (false);
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7682
        }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7683
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7684
        for (inst=0; inst<nInsts; inst++) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7685
            OBJ instVar = __InstPtr(self)->i_instvars[inst];
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7686
            int i;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7687
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7688
            if (((char *)instVar >= minAddr) && ((char *)instVar <= maxAddr)) {
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7689
#if defined(memsrch4)
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7690
                if (memsrch4(__arrayVal(aCollection), (INT)instVar, nObjs)) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7691
                    RETURN (true);
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7692
                }
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7693
#else
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7694
                for (i=0; i<nObjs; i++) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7695
                    OBJ anObject;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7696
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7697
                    anObject = __ArrayInstPtr(aCollection)->a_element[i];
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7698
                    if (instVar == anObject) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7699
                        RETURN (true);
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7700
                    }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7701
                }
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7702
#endif /* memsrch4 */
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7703
            }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7704
        }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7705
        RETURN (false);
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7706
    }
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7707
%}.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7708
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7709
    aCollection do:[:el |
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7710
        (self referencesObject:el) ifTrue:[^ true].
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7711
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7712
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7713
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7714
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7715
referencesDerivedInstanceOf:aClass
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7716
    "return true, if the receiver refers to an instance of
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7717
     the argument, aClass or its subclass. This method exists
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7718
     to support searching for users of a class."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7719
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  7720
    |myClass
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7721
     numInst "{ Class: SmallInteger }" |
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7722
6631
5ffa1ce7b2cc #isExceptionCreator instead of #isSignal
Stefan Vogel <sv@exept.de>
parents: 6600
diff changeset
  7723
    "check the class"
5ffa1ce7b2cc #isExceptionCreator instead of #isSignal
Stefan Vogel <sv@exept.de>
parents: 6600
diff changeset
  7724
    (self isKindOf:aClass) ifTrue:[^ true].
5ffa1ce7b2cc #isExceptionCreator instead of #isSignal
Stefan Vogel <sv@exept.de>
parents: 6600
diff changeset
  7725
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7726
    myClass := self class.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7727
    "check the instance variables"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7728
    numInst := myClass instSize.
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  7729
    1 to:numInst do:[:i |
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7730
        ((self instVarAt:i) isKindOf:aClass) ifTrue:[^ true]
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7731
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7732
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7733
    "check the indexed variables"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7734
    myClass isVariable ifTrue:[
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7735
        myClass isPointers ifFalse:[
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7736
            "no need to search in non pointer fields"
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7737
            ((aClass == Number) or:[aClass isSubclassOf:Number]) ifFalse:[^ false].
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7738
        ].
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7739
        numInst := self basicSize.
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7740
        1 to:numInst do:[:i |
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7741
            ((self basicAt:i) isKindOf:aClass) ifTrue:[^ true]
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7742
        ]
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
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7745
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7746
    "
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  7747
     (1 @ 3.4) referencesDerivedInstanceOf:Number
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  7748
     (1 @ 3.4) referencesDerivedInstanceOf:Array
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  7749
     View new initialize referencesDerivedInstanceOf:DeviceWorkstation
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7750
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7751
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7752
9279
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  7753
referencesForWhich:checkBlock do:actionBlock
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  7754
    |myClass inst
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  7755
     numInst "{ Class: SmallInteger }" |
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  7756
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  7757
    myClass := self class.
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  7758
    "check the instance variables"
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  7759
    numInst := myClass instSize.
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  7760
    1 to:numInst do:[:i |
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7761
        inst := self instVarAt:i.
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7762
        (checkBlock value:inst) ifTrue:[actionBlock value:inst].
9279
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  7763
    ].
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  7764
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  7765
    "check the indexed variables"
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  7766
    myClass isVariable ifTrue:[
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7767
        myClass isPointers ifTrue:[
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7768
            "no need to search in non pointer fields"
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7769
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7770
            numInst := self basicSize.
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7771
            1 to:numInst do:[:i |
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7772
                inst := self basicAt:i.
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7773
                (checkBlock value:inst) ifTrue:[actionBlock value:inst].
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7774
            ]
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7775
        ]
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  7776
    ].
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  7777
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  7778
    "
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  7779
     (1 @ 3.4) referencesForWhich:[:i | i isFloat] do:[:i | Transcript showCR:i]
9279
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  7780
    "
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  7781
!
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  7782
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7783
referencesInstanceOf:aClass
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7784
    "return true, if the receiver refers to an instance of
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7785
     the argument, aClass.This method exists
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7786
     to support searching for users of a class."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7787
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  7788
    |myClass
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7789
     numInst "{ Class: SmallInteger }" |
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7790
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7791
    myClass := self class.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7792
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7793
    "check the class"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7794
    (myClass isMemberOf:aClass) ifTrue:[^ true].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7795
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7796
    "check the instance variables"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7797
    numInst := myClass instSize.
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  7798
    1 to:numInst do:[:i |
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7799
        ((self instVarAt:i) isMemberOf:aClass) ifTrue:[^ true]
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7800
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7801
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7802
    "check the indexed variables"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7803
    myClass isVariable ifTrue:[
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7804
        myClass isPointers ifFalse:[
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7805
            "no need to search in non-pointer indexed fields"
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7806
            myClass isLongs ifTrue:[
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7807
                (aClass == SmallInteger or:[aClass == LargeInteger]) ifFalse:[^ false].
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7808
            ] ifFalse:[
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7809
                myClass isFloatsOrDoubles ifTrue:[^ aClass == Float].
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7810
                ^ aClass == SmallInteger
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7811
            ]
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7812
        ].
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7813
        numInst := self basicSize.
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7814
        1 to:numInst do:[:i |
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7815
            ((self basicAt:i) isMemberOf:aClass) ifTrue:[^ true]
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7816
        ]
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7817
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7818
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7819
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7820
    "
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  7821
     (1 @ 3.4) referencesInstanceOf:Float
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  7822
     (1 @ 3.4) referencesInstanceOf:Fraction
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  7823
     View new initialize referencesInstanceOf:(Display class)
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7824
    "
6074
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7825
!
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7826
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7827
referencesObject:anObject
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7828
    "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
  7829
     - for debugging only"
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7830
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7831
%{  /* NOCONTEXT */
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7832
    OBJ cls, flags;
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7833
    int nInsts, i;
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7834
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7835
    if (! __isNonNilObject(self)) {
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7836
        RETURN (false);
6074
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
    /*
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7840
     * 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
  7841
     * 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
  7842
     * 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
  7843
     */
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7844
    if (__isNonNilObject(anObject)) {
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7845
        if ((__qSpace(self) <= OLDSPACE) && !__isRemembered(self)) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7846
            int spc;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7847
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7848
            if (((spc = __qSpace(anObject)) == NEWSPACE) || (spc == SURVSPACE)) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7849
                RETURN (false);
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7850
            }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7851
        }
6074
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
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7854
    cls = __qClass(self);
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7855
    if (cls == anObject) {
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7856
        RETURN (true);
6074
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
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7859
    flags = __ClassInstPtr(cls)->c_flags;
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7860
    if (((INT)flags & __MASKSMALLINT(ARRAYMASK)) == __MASKSMALLINT(POINTERARRAY)) {
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7861
        nInsts = __BYTES2OBJS__(__qSize(self) - OHDR_SIZE);
6074
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7862
    } else {
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7863
        nInsts = __intVal(__ClassInstPtr(cls)->c_ninstvars);
6074
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
    if (! nInsts) {
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7866
        RETURN (false);
6074
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
#if defined(memsrch4)
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7869
    if (memsrch4(__InstPtr(self)->i_instvars, (INT)anObject, nInsts)) {
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7870
        RETURN (true);
6074
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
#else
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7873
    for (i=0; i<nInsts; i++) {
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7874
        if (__InstPtr(self)->i_instvars[i] == anObject) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7875
            RETURN (true);
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7876
        }
6074
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7877
    }
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7878
#endif /* memsrch4 */
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7879
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7880
%}.
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7881
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  7882
"/    |myClass
6074
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7883
"/     numInst "{ Class: SmallInteger }" |
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7884
"/
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7885
"/    myClass := self class.
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7886
"/
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7887
"/    "check the class"
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7888
"/    (myClass == anObject) ifTrue:[^ true].
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7889
"/
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7890
"/    "check the instance variables"
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7891
"/    numInst := myClass instSize.
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  7892
"/    1 to:numInst do:[:i |
6074
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7893
"/      ((self instVarAt:i) == anObject) ifTrue:[^ true]
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7894
"/    ].
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7895
"/
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7896
"/    "check the indexed variables"
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7897
"/    myClass isVariable ifTrue:[
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7898
"/      myClass isPointers ifFalse:[
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7899
"/          "/
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7900
"/          "/ 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
  7901
"/          "/ 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
  7902
"/          "/ 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
  7903
"/          "/ 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
  7904
"/          "/ 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
  7905
"/          "/ 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
  7906
"/          "/ 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
  7907
"/
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7908
"/          ^ false.
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7909
"/
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7910
"/          "/ alternative:
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7911
"/          "/  anObject isNumber ifFalse:[^ false].
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7912
"/      ].
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7913
"/
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7914
"/      "/
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7915
"/      "/ 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
  7916
"/      "/ idenitytIndex method, use it
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7917
"/      "/
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7918
"/      myClass == Array ifTrue:[
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7919
"/          ^ (self identityIndexOf:anObject) ~~ 0
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7920
"/      ].
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7921
"/
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7922
"/      "/
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7923
"/      "/ otherwise, do it the slow way
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7924
"/      "/
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7925
"/      numInst := self basicSize.
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  7926
"/      1 to:numInst do:[:i |
6074
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7927
"/          ((self basicAt:i) == anObject) ifTrue:[^ true]
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7928
"/      ]
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7929
"/    ].
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7930
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7931
    ^ false
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7932
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7933
    "
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7934
     |v|
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7935
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7936
     v := View new initialize.
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  7937
     v references:Display.
6074
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7938
    "
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7939
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7940
14296
fe82bc5091f9 added: #isUUID
Stefan Vogel <sv@exept.de>
parents: 14292
diff changeset
  7941
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7942
!Object methodsFor:'synchronized evaluation'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7943
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  7944
freeSynchronizationSemaphore
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7945
    "free synchronizationSemaphore. May be used, to save memory when
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7946
     an object is no longer used synchronized."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7947
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7948
    |sema|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7949
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7950
    sema := self synchronizationSemaphore.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7951
    sema notNil ifTrue:[
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7952
        sema wait.              "/ get lock
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7953
        self synchronizationSemaphore:nil.
5755
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
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7957
     self synchronized:[].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7958
     self synchronizationSemaphore.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7959
     self freeSynchronizationSemaphore.
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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7962
    "Created: 28.1.1997 / 19:31:20 / stefan"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7963
    "Modified: 28.1.1997 / 19:47:55 / stefan"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7964
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7965
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7966
synchronizationSemaphore
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7967
    "return the synchronization semaphore for myself.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7968
     subclasses may redefine"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7969
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7970
    ^ SynchronizationSemaphores at:self ifAbsent:[].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7971
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 synchronizationSemaphore
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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7976
    "Modified: 28.1.1997 / 19:47:09 / stefan"
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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7979
synchronizationSemaphore:aSemaphore
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7980
    "set the synchronisationSemaphore for myself.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7981
     subclasses may redefine this method"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7982
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7983
    aSemaphore isNil ifTrue:[
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7984
        "/ remove Semaphore
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7985
        SynchronizationSemaphores removeKey:self ifAbsent:nil.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7986
    ] ifFalse:[
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  7987
        SynchronizationSemaphores at:self put:aSemaphore.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7988
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7989
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7990
    "Modified: 28.1.1997 / 19:37:48 / stefan"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7991
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7992
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7993
synchronized:aBlock
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7994
    "evaluate aBlock synchronized, i.e. use a monitor for this object"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7995
6600
9c85adf293dd Simplify #synchronized:
Stefan Vogel <sv@exept.de>
parents: 6572
diff changeset
  7996
    |sema wasBlocked|
9c85adf293dd Simplify #synchronized:
Stefan Vogel <sv@exept.de>
parents: 6572
diff changeset
  7997
9c85adf293dd Simplify #synchronized:
Stefan Vogel <sv@exept.de>
parents: 6572
diff changeset
  7998
    wasBlocked := OperatingSystem blockInterrupts.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7999
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8000
    sema := self synchronizationSemaphore.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8001
    sema isNil ifTrue:[
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  8002
        sema := RecursionLock new name:self className.
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  8003
        self synchronizationSemaphore:sema.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8004
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8005
6600
9c85adf293dd Simplify #synchronized:
Stefan Vogel <sv@exept.de>
parents: 6572
diff changeset
  8006
    wasBlocked ifFalse:[OperatingSystem unblockInterrupts].
7211
87f5d25b5c3d Make synchronizationSemaphore a recursionLock
Stefan Vogel <sv@exept.de>
parents: 7208
diff changeset
  8007
    sema critical:aBlock.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8008
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8009
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8010
       [Object synchronized:[Delay waitForSeconds:2. Transcript showCR:'1']] fork.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8011
       [Object synchronized:[Delay waitForSeconds:2. Transcript showCR:'2']] fork.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8012
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8013
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8014
    "Created: 28.1.1997 / 17:52:56 / stefan"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8015
    "Modified: 30.1.1997 / 13:38:54 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8016
    "Modified: 20.2.1997 / 09:43:35 / stefan"
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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8019
!Object methodsFor:'system primitives'!
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
asOop
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8022
    "ST-80 compatibility:
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8023
     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
  8024
     or index); since ST/X has no such thing, and the objects address cannot
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  8025
     be used (since its changing over time), we return the objects identityHash
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8026
     key, which provides (at least) some identity indication.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8027
     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
  8028
     key of two non-identical objects may be the same.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8029
     You'd better not use it - especially do not misuse it."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8030
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8031
    ^ self identityHash
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8032
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8033
    "Created: 9.11.1996 / 19:09:56 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8034
    "Modified: 9.11.1996 / 19:16:04 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8035
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8036
8939
ac97eb450b97 Fix examples in #perform:*ifNotUnderstood:
Stefan Vogel <sv@exept.de>
parents: 8935
diff changeset
  8037
beImmutable
ac97eb450b97 Fix examples in #perform:*ifNotUnderstood:
Stefan Vogel <sv@exept.de>
parents: 8935
diff changeset
  8038
    "experimental - not yet usable; do not use"
ac97eb450b97 Fix examples in #perform:*ifNotUnderstood:
Stefan Vogel <sv@exept.de>
parents: 8935
diff changeset
  8039
ac97eb450b97 Fix examples in #perform:*ifNotUnderstood:
Stefan Vogel <sv@exept.de>
parents: 8935
diff changeset
  8040
%{  /* NOCONTEXT */
ac97eb450b97 Fix examples in #perform:*ifNotUnderstood:
Stefan Vogel <sv@exept.de>
parents: 8935
diff changeset
  8041
    if (! __isNonNilObject(self)) {
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  8042
        RETURN (self);
8939
ac97eb450b97 Fix examples in #perform:*ifNotUnderstood:
Stefan Vogel <sv@exept.de>
parents: 8935
diff changeset
  8043
    }
ac97eb450b97 Fix examples in #perform:*ifNotUnderstood:
Stefan Vogel <sv@exept.de>
parents: 8935
diff changeset
  8044
    __beImmutable(self);
ac97eb450b97 Fix examples in #perform:*ifNotUnderstood:
Stefan Vogel <sv@exept.de>
parents: 8935
diff changeset
  8045
%}
ac97eb450b97 Fix examples in #perform:*ifNotUnderstood:
Stefan Vogel <sv@exept.de>
parents: 8935
diff changeset
  8046
!
ac97eb450b97 Fix examples in #perform:*ifNotUnderstood:
Stefan Vogel <sv@exept.de>
parents: 8935
diff changeset
  8047
ac97eb450b97 Fix examples in #perform:*ifNotUnderstood:
Stefan Vogel <sv@exept.de>
parents: 8935
diff changeset
  8048
beMutable
ac97eb450b97 Fix examples in #perform:*ifNotUnderstood:
Stefan Vogel <sv@exept.de>
parents: 8935
diff changeset
  8049
    "experimental - not yet usable; do not use"
ac97eb450b97 Fix examples in #perform:*ifNotUnderstood:
Stefan Vogel <sv@exept.de>
parents: 8935
diff changeset
  8050
ac97eb450b97 Fix examples in #perform:*ifNotUnderstood:
Stefan Vogel <sv@exept.de>
parents: 8935
diff changeset
  8051
%{  /* NOCONTEXT */
ac97eb450b97 Fix examples in #perform:*ifNotUnderstood:
Stefan Vogel <sv@exept.de>
parents: 8935
diff changeset
  8052
    if (! __isNonNilObject(self)) {
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  8053
        RETURN (self);
8939
ac97eb450b97 Fix examples in #perform:*ifNotUnderstood:
Stefan Vogel <sv@exept.de>
parents: 8935
diff changeset
  8054
    }
ac97eb450b97 Fix examples in #perform:*ifNotUnderstood:
Stefan Vogel <sv@exept.de>
parents: 8935
diff changeset
  8055
    __beMutable(self);
ac97eb450b97 Fix examples in #perform:*ifNotUnderstood:
Stefan Vogel <sv@exept.de>
parents: 8935
diff changeset
  8056
%}
ac97eb450b97 Fix examples in #perform:*ifNotUnderstood:
Stefan Vogel <sv@exept.de>
parents: 8935
diff changeset
  8057
!
ac97eb450b97 Fix examples in #perform:*ifNotUnderstood:
Stefan Vogel <sv@exept.de>
parents: 8935
diff changeset
  8058
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8059
become:anotherObject
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8060
    "make all references to the receiver become references to anotherObject
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8061
     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
  8062
     This can be a very dangerous operation - be warned.
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  8063
     In general, using #become: should be avoided if possible, since it may
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8064
     produce many strange effects (think of hashing in Sets, Dictionaries etc.).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8065
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  8066
     This may also be an expensive (i.e. slow) operation,
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  8067
     since in the worst case, the whole memory has to be searched for
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8068
     references to the two objects (although the primitive tries hard to
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  8069
     limit the search, for acceptable performance in most cases).
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  8070
     This method fails, if the receiver or the argument is a SmallInteger
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  8071
     or nil, or is a context of a living method (i.e. one that has not already
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8072
     returned).
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  8073
     (notice that #become: is not used heavily by the system
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8074
      - the Collection-classes have been rewritten to not use it.)"
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
    if (__primBecome(self, anotherObject)) {
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  8077
        RETURN ( self );
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8078
    }
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8079
%}.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8080
    self primitiveFailed
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8081
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8082
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8083
becomeNil
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8084
    "make all references to the receiver become nil - effectively getting
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  8085
     rid of the receiver.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8086
     This can be a very dangerous operation - be warned.
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
     This may be an expensive (i.e. slow) operation.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8089
     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
  8090
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8091
%{
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8092
    if (__primBecomeNil(self)) {
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  8093
        RETURN ( nil );
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8094
    }
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8095
%}.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8096
    self primitiveFailed
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8097
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8098
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8099
becomeSameAs:anotherObject
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8100
    "make all references to the receiver become references to anotherObject
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8101
     but NOT vice versa (as done in #become:).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8102
     This can be a very dangerous operation - be warned.
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  8103
     In general, using #become: should be avoided if possible, since it may
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8104
     produce many strange effects (think of hashing in Sets, Dictionaries etc.).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8105
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8106
     This may also be an expensive (i.e. slow) operation,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8107
     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
  8108
     references to the two objects (although the primitive tries hard to
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8109
     limit the search, for acceptable performance in most cases).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8110
     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
  8111
     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
  8112
%{
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8113
    if (__primBecomeSameAs(self, anotherObject)) {
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  8114
        RETURN ( self );
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8115
    }
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8116
%}.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8117
    self primitiveFailed
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8118
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8119
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8120
changeClassTo:otherClass
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8121
    "changes the class of the receiver to the argument, otherClass.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8122
     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
  8123
     have the same structure (i.e. number of named instance variables and
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  8124
     type of indexed instance variables).
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8125
     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
  8126
     is UndefinedObject or a Smallinteger, a primitive error is triggered."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8127
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8128
    |myClass ok|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8129
9405
cdeae08708cd comments
Stefan Vogel <sv@exept.de>
parents: 9375
diff changeset
  8130
    otherClass autoload.
cdeae08708cd comments
Stefan Vogel <sv@exept.de>
parents: 9375
diff changeset
  8131
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8132
    "check for UndefinedObject/SmallInteger receiver or newClass"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8133
%{
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8134
    {
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  8135
        OBJ other = otherClass;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  8136
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  8137
        if (__isNonNilObject(self)
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  8138
         && __isNonNilObject(other)
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  8139
         && (other != UndefinedObject)
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  8140
         && (other != SmallInteger)) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  8141
            ok = true;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  8142
        } else {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  8143
            ok = false;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  8144
        }
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8145
    }
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8146
%}.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8147
    ok ifTrue:[
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  8148
        ok := false.
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  8149
        myClass := self class.
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  8150
        myClass flags == otherClass flags ifTrue:[
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  8151
            myClass instSize == otherClass instSize ifTrue:[
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  8152
                "same instance layout and types: its ok to do it"
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  8153
                ok := true.
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  8154
            ] ifFalse:[
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  8155
                myClass isPointers ifTrue:[
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  8156
                    myClass isVariable ifTrue:[
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  8157
                        ok := true
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  8158
                    ]
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  8159
                ]
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  8160
            ]
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  8161
        ] ifFalse:[
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  8162
            myClass isPointers ifTrue:[
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  8163
                "if newClass is a variable class, with instSize <= my instsize,
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  8164
                 we can do it (effectively mapping additional instvars into the
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  8165
                 variable part) - usefulness is questionable, though"
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  8166
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  8167
                otherClass isPointers ifTrue:[
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  8168
                    otherClass isVariable ifTrue:[
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  8169
                        otherClass instSize <= (myClass instSize + self basicSize)
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  8170
                        ifTrue:[
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  8171
                            ok := true
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  8172
                        ]
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  8173
                    ] ifFalse:[
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  8174
                        otherClass instSize == (myClass instSize + self basicSize)
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  8175
                        ifTrue:[
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  8176
                            ok := true
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  8177
                        ]
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  8178
                    ]
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  8179
                ] ifFalse:[
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  8180
                    "it does not make sense to convert pointers to bytes ..."
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  8181
                ]
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  8182
            ] ifFalse:[
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  8183
                "does it make sense, to convert bits ?"
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  8184
                "could allow byteArray->wordArray->longArray->floatArray->doubleArray here ..."
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  8185
                (myClass isBitsExtended and:[otherClass isBitsExtended]) ifTrue:[
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  8186
                    ok := true
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  8187
                ]
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  8188
            ]
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  8189
        ]
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8190
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8191
    ok ifTrue:[
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  8192
        "now, change the receivers class ..."
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8193
%{
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  8194
        {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  8195
            OBJ me = self;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  8196
14369
932a73ac77f5 Assignment to __qClass(o) didn't work any longer after the cast introduces to the __qClass() macro
Stefan Vogel <sv@exept.de>
parents: 14368
diff changeset
  8197
            __objPtr(me)->o_class = (CLASS_OBJ)otherClass;
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  8198
            __STORE(me, otherClass);
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  8199
            RETURN (me);
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  8200
        }
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8201
%}.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8202
    ].
9405
cdeae08708cd comments
Stefan Vogel <sv@exept.de>
parents: 9375
diff changeset
  8203
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8204
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8205
     the receiver cannot be represented as a instance of
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8206
     the desired class.
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  8207
     For example, you cannot change a bitInstance (byteArray etc.)
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8208
     into a pointer object and vice versa.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8209
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8210
    self primitiveFailed
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8211
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8212
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8213
changeClassToThatOf:anObject
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8214
    "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
  8215
     This is only allowed (possible), if the receivers class and the arguments
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  8216
     class have the same structure (i.e. number of named instance variables and
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8217
     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
  8218
     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
  8219
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8220
    self changeClassTo:(anObject class)
6033
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  8221
!
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  8222
8935
f770c55ba40e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8934
diff changeset
  8223
isImmutable
f770c55ba40e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8934
diff changeset
  8224
    "experimental - not yet usable; do not use"
f770c55ba40e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8934
diff changeset
  8225
f770c55ba40e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8934
diff changeset
  8226
%{  /* NOCONTEXT */
f770c55ba40e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8934
diff changeset
  8227
    if (! __isNonNilObject(self)) {
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  8228
        RETURN (true);
8935
f770c55ba40e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8934
diff changeset
  8229
    }
f770c55ba40e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8934
diff changeset
  8230
    RETURN (__isImmutable(self) ? true : false);
f770c55ba40e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8934
diff changeset
  8231
%}
f770c55ba40e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8934
diff changeset
  8232
!
f770c55ba40e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8934
diff changeset
  8233
6033
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  8234
replaceReferencesTo:anObject with:newRef
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  8235
    "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
  8236
     Return true, if any reference was changed.
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  8237
     Notice: this does not change the class-reference."
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  8238
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  8239
%{  /* NOCONTEXT */
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  8240
    OBJ cls, flags, anyChange;
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  8241
    int nInsts, i;
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  8242
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  8243
    if (! __isNonNilObject(self)) {
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  8244
        RETURN (false);
6033
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  8245
    }
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  8246
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  8247
    /*
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  8248
     * a little optimization: use the fact that all old objects
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  8249
     * 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
  8250
     * a trivial reject is possible, if anObject is a newbee
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  8251
     */
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  8252
    if (__isNonNilObject(anObject)) {
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  8253
        if ((__qSpace(self) <= OLDSPACE) && !__isRemembered(self)) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  8254
            int spc;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  8255
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  8256
            if (((spc = __qSpace(anObject)) == NEWSPACE) || (spc == SURVSPACE)) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  8257
                RETURN (false);
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  8258
            }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  8259
        }
6033
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  8260
    }
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  8261
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  8262
    cls = __qClass(self);
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  8263
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  8264
    flags = __ClassInstPtr(cls)->c_flags;
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  8265
    if (((INT)flags & __MASKSMALLINT(ARRAYMASK)) == __MASKSMALLINT(POINTERARRAY)) {
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  8266
        nInsts = __BYTES2OBJS__(__qSize(self) - OHDR_SIZE);
6033
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  8267
    } else {
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  8268
        nInsts = __intVal(__ClassInstPtr(cls)->c_ninstvars);
6033
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  8269
    }
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  8270
    if (! nInsts) {
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  8271
        RETURN (false);
6033
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  8272
    }
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  8273
    anyChange = false;
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  8274
    for (i=0; i<nInsts; i++) {
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  8275
        if (__InstPtr(self)->i_instvars[i] == anObject) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  8276
            __InstPtr(self)->i_instvars[i] = newRef;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  8277
            __STORE(self, newRef);
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  8278
            anyChange = true;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  8279
        }
6033
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  8280
    }
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  8281
    RETURN (anyChange);
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  8282
%}.
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  8283
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  8284
    "
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  8285
     |v|
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  8286
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  8287
     v := Array with:1234 with:'hello' with:Array.
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  8288
     v replaceReferencesTo:Array with:ByteArray.
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  8289
     v inspect
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  8290
    "
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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8293
!Object methodsFor:'testing'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8294
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8295
? defaultValue
11634
657c12384132 Fix spelling
Stefan Vogel <sv@exept.de>
parents: 11573
diff changeset
  8296
     "a syntactic sugar-piece:
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8297
      if the receiver is nil, return the defaultValue;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8298
      otherwise, return the receiver.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8299
      This method is only redefined in UndefinedObject - therefore,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8300
      the recevier is retuned here.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8301
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8302
      Thus, if foo and bar are simple variables or constants,
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  8303
          foo ? bar
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8304
      is the same as:
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  8305
          (foo isNil ifTrue:[bar] ifFalse:[foo])
5755
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
      if they are message sends, the equivalent code is:
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  8308
          [
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  8309
              |t1 t2|
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  8310
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  8311
              t1 := foo.
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  8312
              t2 := bar.
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  8313
              t1 isNil ifTrue:[t2] ifFalse:[t1]
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  8314
          ] value
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8315
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8316
      Can be used to provide defaultValues to variables,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8317
      as in:
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  8318
          foo := arg ? #defaultValue
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8319
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8320
      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
  8321
      Notice:
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  8322
         This method is open coded (inlined) by the compiler(s)
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  8323
         - redefining it may not work as expected."
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8324
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8325
    ^ self
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8326
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8327
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8328
     1 ? #default
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8329
     nil ? #default
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8330
    "
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
    "Created: / 4.11.1996 / 20:36:19 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8333
    "Modified: / 19.5.1998 / 17:39:56 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8334
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8335
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8336
?? defaultValue
11634
657c12384132 Fix spelling
Stefan Vogel <sv@exept.de>
parents: 11573
diff changeset
  8337
     "a syntactic sugar-piece:
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8338
      much like ?, but sends #value to the argument if required.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8339
      (i.e. its the same as #ifNil:)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8340
      If the receiver is nil, return the defaultValues value;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8341
      otherwise, return the receiver.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8342
      This method is only redefined in UndefinedObject - therefore,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8343
      the recevier is retuned here.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8344
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8345
      Thus, if foo and bar are simple variables or constants,
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  8346
          foo ?? bar
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8347
      is the same as:
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  8348
          (foo isNil ifTrue:[bar value] ifFalse:[foo])
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8349
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8350
      if they are message sends, the equivalent code is:
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  8351
          [
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  8352
              |t t2|
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  8353
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  8354
              t := foo.
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  8355
              t isNil ifTrue:[bar value] ifFalse:[t]
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  8356
          ] value
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8357
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8358
      Can be used to provide defaultValues to variables,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8359
      as in:
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  8360
          foo := arg ?? [ self computeDefault ]
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
      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
  8363
     "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8364
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8365
    ^ self
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8366
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8367
    "
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  8368
     1 ?? #default
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8369
     nil ?? #default
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  8370
     1 ?? [ self halt. 1 + 2 ]
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  8371
     nil ?? [ self halt. 1 + 2 ]
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  8372
     1 ?? [Date today]
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  8373
     nil ?? [Date today]
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8374
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8375
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8376
    "Created: / 4.11.1996 / 20:36:19 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8377
    "Modified: / 19.5.1998 / 17:42:56 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8378
!
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
ifNil:aBlockOrValue
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8381
    "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
  8382
     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
  8383
     receiver.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8384
     Notice:
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  8385
        This method is open coded (inlined) by the compiler(s)
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  8386
        - redefining it may not work as expected."
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8387
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8388
    ^ self
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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8391
ifNil:nilBlockOrValue ifNotNil:notNilBlockOrValue
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8392
    "return the value of the first arg, if I am nil,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8393
     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
  8394
     Notice:
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  8395
        This method is open coded (inlined) by the compiler(s)
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  8396
        - redefining it may not work as expected."
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8397
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8398
    ^ notNilBlockOrValue value
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8399
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8400
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8401
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8402
ifNotNil:aBlockOrValue
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  8403
    "return myself if nil, or the result from evaluating the argument,
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8404
     if I am not nil.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8405
     Notice:
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  8406
        This method is open coded (inlined) by the compiler(s)
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  8407
        - redefining it may not work as expected."
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8408
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8409
    ^ aBlockOrValue value
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8410
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8411
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8412
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8413
ifNotNil:notNilBlockOrValue ifNil:nilBlockOrValue
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8414
    "return the value of the 2nd arg, if I am nil,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8415
     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
  8416
     Notice:
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  8417
        This method is open coded (inlined) by the compiler(s)
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  8418
        - redefining it may not work as expected."
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8419
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8420
    ^ notNilBlockOrValue value
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8421
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8422
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8423
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8424
8574
33bb637901eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8563
diff changeset
  8425
ifNotNilDo:aBlock
33bb637901eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8563
diff changeset
  8426
    "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
  8427
     Otherwise do nothing and return nil."
33bb637901eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8563
diff changeset
  8428
33bb637901eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8563
diff changeset
  8429
    ^ aBlock value:self
33bb637901eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8563
diff changeset
  8430
!
33bb637901eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8563
diff changeset
  8431
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8432
isArray
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8433
    "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
  8434
     false is returned here - the method is only redefined in Array."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8435
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8436
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8437
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8438
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8439
isAssociation
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8440
    "return true, if the receiver is some kind of association;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8441
     false is returned here - the method is only redefined in Association."
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
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8444
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8445
    "Created: 14.5.1996 / 17:03:45 / cg"
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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8448
isBehavior
9221
d8fff4a78065 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9216
diff changeset
  8449
    "return true, if the receiver is describing another objects behavior.
d8fff4a78065 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9216
diff changeset
  8450
     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
  8451
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8452
    ^ false
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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8455
isBlock
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8456
    "return true, if the receiver is some kind of block;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8457
     false returned here - the method is only redefined in Block."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8458
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8459
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8460
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8461
5824
fdf9cd50a141 Added method isBoolean; need this!
martin
parents: 5821
diff changeset
  8462
isBoolean
fdf9cd50a141 Added method isBoolean; need this!
martin
parents: 5821
diff changeset
  8463
    "return true, if the receiver is a boolean;
fdf9cd50a141 Added method isBoolean; need this!
martin
parents: 5821
diff changeset
  8464
     false is returned here - the method is only redefined in Boolean."
fdf9cd50a141 Added method isBoolean; need this!
martin
parents: 5821
diff changeset
  8465
fdf9cd50a141 Added method isBoolean; need this!
martin
parents: 5821
diff changeset
  8466
    ^ false
fdf9cd50a141 Added method isBoolean; need this!
martin
parents: 5821
diff changeset
  8467
!
fdf9cd50a141 Added method isBoolean; need this!
martin
parents: 5821
diff changeset
  8468
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8469
isByteArray
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8470
    "return true, if the receiver is some kind of bytearray;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8471
     false is returned here - the method is only redefined in ByteArray."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8472
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8473
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8474
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8475
8986
c2962d45eca0 new: #isByteCollection
Stefan Vogel <sv@exept.de>
parents: 8977
diff changeset
  8476
isByteCollection
c2962d45eca0 new: #isByteCollection
Stefan Vogel <sv@exept.de>
parents: 8977
diff changeset
  8477
    "return true, if the receiver is some kind of byte collection,
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  8478
     i.e. #at: and #at:put: accesses a byte. This is different from 'self class isBytes',
8986
c2962d45eca0 new: #isByteCollection
Stefan Vogel <sv@exept.de>
parents: 8977
diff changeset
  8479
     since e.g. in BitArray single bits are accessed, but it is implemented as variableBytes class.
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  8480
8986
c2962d45eca0 new: #isByteCollection
Stefan Vogel <sv@exept.de>
parents: 8977
diff changeset
  8481
     false is returned here - the method is only redefined in UninterpretedBytes."
c2962d45eca0 new: #isByteCollection
Stefan Vogel <sv@exept.de>
parents: 8977
diff changeset
  8482
c2962d45eca0 new: #isByteCollection
Stefan Vogel <sv@exept.de>
parents: 8977
diff changeset
  8483
    ^ false
c2962d45eca0 new: #isByteCollection
Stefan Vogel <sv@exept.de>
parents: 8977
diff changeset
  8484
!
c2962d45eca0 new: #isByteCollection
Stefan Vogel <sv@exept.de>
parents: 8977
diff changeset
  8485
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8486
isCharacter
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8487
    "return true, if the receiver is some kind of character;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8488
     false is returned here - the method is only redefined in Character."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8489
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8490
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8491
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8492
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8493
isClass
9405
cdeae08708cd comments
Stefan Vogel <sv@exept.de>
parents: 9375
diff changeset
  8494
    "return true, if the receiver is some kind of class
cdeae08708cd comments
Stefan Vogel <sv@exept.de>
parents: 9375
diff changeset
  8495
     (real class, not just behavior);
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8496
     false is returned here - the method is only redefined in Class."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8497
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8498
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8499
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8500
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8501
isCollection
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8502
    "return true, if the receiver is some kind of collection;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8503
     false is returned here - the method is only redefined in Collection."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8504
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8505
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8506
!
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
isColor
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8509
    "return true, if the receiver is some kind of color;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8510
     false is returned here - the method is only redefined in Color."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8511
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8512
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8513
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8514
6567
cba5c3103600 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6549
diff changeset
  8515
isCons
cba5c3103600 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6549
diff changeset
  8516
    "return true, if the receiver is a cons (pair);
cba5c3103600 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6549
diff changeset
  8517
     false is returned here - the method is only redefined in Cons."
cba5c3103600 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6549
diff changeset
  8518
cba5c3103600 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6549
diff changeset
  8519
    ^ false
cba5c3103600 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6549
diff changeset
  8520
!
cba5c3103600 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6549
diff changeset
  8521
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8522
isContext
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8523
    "return true, if the receiver is some kind of context;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8524
     false returned here - the method is only redefined in Context."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8525
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8526
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8527
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8528
6181
5876cc789e41 + isEmptyOrNil
Claus Gittinger <cg@exept.de>
parents: 6175
diff changeset
  8529
isEmptyOrNil
8833
717b01292d0e comments
Stefan Vogel <sv@exept.de>
parents: 8832
diff changeset
  8530
    "return true if I am nil or an empty collection - return false here.
717b01292d0e comments
Stefan Vogel <sv@exept.de>
parents: 8832
diff changeset
  8531
     (from Squeak)"
6181
5876cc789e41 + isEmptyOrNil
Claus Gittinger <cg@exept.de>
parents: 6175
diff changeset
  8532
5876cc789e41 + isEmptyOrNil
Claus Gittinger <cg@exept.de>
parents: 6175
diff changeset
  8533
    ^ false
5876cc789e41 + isEmptyOrNil
Claus Gittinger <cg@exept.de>
parents: 6175
diff changeset
  8534
5876cc789e41 + isEmptyOrNil
Claus Gittinger <cg@exept.de>
parents: 6175
diff changeset
  8535
    "Created: / 13.11.2001 / 13:17:04 / cg"
6182
2b992cf865bc comment
Claus Gittinger <cg@exept.de>
parents: 6181
diff changeset
  8536
    "Modified: / 13.11.2001 / 13:28:40 / cg"
6181
5876cc789e41 + isEmptyOrNil
Claus Gittinger <cg@exept.de>
parents: 6175
diff changeset
  8537
!
5876cc789e41 + isEmptyOrNil
Claus Gittinger <cg@exept.de>
parents: 6175
diff changeset
  8538
6221
404495587300 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6203
diff changeset
  8539
isException
6631
5ffa1ce7b2cc #isExceptionCreator instead of #isSignal
Stefan Vogel <sv@exept.de>
parents: 6600
diff changeset
  8540
    "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
  8541
6221
404495587300 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6203
diff changeset
  8542
    ^ false
404495587300 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6203
diff changeset
  8543
404495587300 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6203
diff changeset
  8544
    "Created: / 17.11.2001 / 18:37:44 / cg"
404495587300 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6203
diff changeset
  8545
!
404495587300 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6203
diff changeset
  8546
6631
5ffa1ce7b2cc #isExceptionCreator instead of #isSignal
Stefan Vogel <sv@exept.de>
parents: 6600
diff changeset
  8547
isExceptionCreator
5ffa1ce7b2cc #isExceptionCreator instead of #isSignal
Stefan Vogel <sv@exept.de>
parents: 6600
diff changeset
  8548
    "return true, if the receiver can create exceptions,
5ffa1ce7b2cc #isExceptionCreator instead of #isSignal
Stefan Vogel <sv@exept.de>
parents: 6600
diff changeset
  8549
     this includes #raise, #raiseRequest as well as the behavior of
5ffa1ce7b2cc #isExceptionCreator instead of #isSignal
Stefan Vogel <sv@exept.de>
parents: 6600
diff changeset
  8550
     an exception handler, such as the #accepts: and #handles: messages"
5ffa1ce7b2cc #isExceptionCreator instead of #isSignal
Stefan Vogel <sv@exept.de>
parents: 6600
diff changeset
  8551
5ffa1ce7b2cc #isExceptionCreator instead of #isSignal
Stefan Vogel <sv@exept.de>
parents: 6600
diff changeset
  8552
    ^ false
5ffa1ce7b2cc #isExceptionCreator instead of #isSignal
Stefan Vogel <sv@exept.de>
parents: 6600
diff changeset
  8553
!
5ffa1ce7b2cc #isExceptionCreator instead of #isSignal
Stefan Vogel <sv@exept.de>
parents: 6600
diff changeset
  8554
5ffa1ce7b2cc #isExceptionCreator instead of #isSignal
Stefan Vogel <sv@exept.de>
parents: 6600
diff changeset
  8555
isExceptionHandler
5ffa1ce7b2cc #isExceptionCreator instead of #isSignal
Stefan Vogel <sv@exept.de>
parents: 6600
diff changeset
  8556
    "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
  8557
     especially to the #accepts: and #handles: messages"
5ffa1ce7b2cc #isExceptionCreator instead of #isSignal
Stefan Vogel <sv@exept.de>
parents: 6600
diff changeset
  8558
5ffa1ce7b2cc #isExceptionCreator instead of #isSignal
Stefan Vogel <sv@exept.de>
parents: 6600
diff changeset
  8559
    ^ false
5ffa1ce7b2cc #isExceptionCreator instead of #isSignal
Stefan Vogel <sv@exept.de>
parents: 6600
diff changeset
  8560
!
5ffa1ce7b2cc #isExceptionCreator instead of #isSignal
Stefan Vogel <sv@exept.de>
parents: 6600
diff changeset
  8561
13187
f79a83bcc243 added: #isExternalAddress
Claus Gittinger <cg@exept.de>
parents: 13165
diff changeset
  8562
isExternalAddress
f79a83bcc243 added: #isExternalAddress
Claus Gittinger <cg@exept.de>
parents: 13165
diff changeset
  8563
    "return true, if the receiver is some kind of externalAddress;
f79a83bcc243 added: #isExternalAddress
Claus Gittinger <cg@exept.de>
parents: 13165
diff changeset
  8564
     false is returned here - the method is only redefined in ExternalAddress."
f79a83bcc243 added: #isExternalAddress
Claus Gittinger <cg@exept.de>
parents: 13165
diff changeset
  8565
f79a83bcc243 added: #isExternalAddress
Claus Gittinger <cg@exept.de>
parents: 13165
diff changeset
  8566
    ^ false
f79a83bcc243 added: #isExternalAddress
Claus Gittinger <cg@exept.de>
parents: 13165
diff changeset
  8567
f79a83bcc243 added: #isExternalAddress
Claus Gittinger <cg@exept.de>
parents: 13165
diff changeset
  8568
    "Created: / 22-12-2010 / 17:20:36 / cg"
f79a83bcc243 added: #isExternalAddress
Claus Gittinger <cg@exept.de>
parents: 13165
diff changeset
  8569
!
f79a83bcc243 added: #isExternalAddress
Claus Gittinger <cg@exept.de>
parents: 13165
diff changeset
  8570
14079
4568576f2690 added: #isExternalBytes
Stefan Vogel <sv@exept.de>
parents: 14078
diff changeset
  8571
isExternalBytes
4568576f2690 added: #isExternalBytes
Stefan Vogel <sv@exept.de>
parents: 14078
diff changeset
  8572
    ^ false
4568576f2690 added: #isExternalBytes
Stefan Vogel <sv@exept.de>
parents: 14078
diff changeset
  8573
!
4568576f2690 added: #isExternalBytes
Stefan Vogel <sv@exept.de>
parents: 14078
diff changeset
  8574
10480
9fc4dd89edb2 +isExternalLibraryFunction
fm
parents: 10460
diff changeset
  8575
isExternalLibraryFunction
9fc4dd89edb2 +isExternalLibraryFunction
fm
parents: 10460
diff changeset
  8576
    "return true, if the receiver is some kind of externalLibrary function;
9fc4dd89edb2 +isExternalLibraryFunction
fm
parents: 10460
diff changeset
  8577
     false is returned here - the method is only redefined in ExternalLibraryFunction."
9fc4dd89edb2 +isExternalLibraryFunction
fm
parents: 10460
diff changeset
  8578
9fc4dd89edb2 +isExternalLibraryFunction
fm
parents: 10460
diff changeset
  8579
    ^false
9fc4dd89edb2 +isExternalLibraryFunction
fm
parents: 10460
diff changeset
  8580
!
9fc4dd89edb2 +isExternalLibraryFunction
fm
parents: 10460
diff changeset
  8581
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8582
isExternalStream
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8583
    "return true, if the receiver is some kind of externalStream;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8584
     false is returned here - the method is only redefined in ExternalStream."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8585
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8586
    ^false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8587
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8588
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8589
isFileStream
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8590
    "return true, if the receiver is some kind of fileStream;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8591
     false is returned here - the method is only redefined in FileStream."
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
    ^false
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
isFilename
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8597
    "return true, if the receiver is some kind of filename;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8598
     false is returned here - the method is only redefined in Filename."
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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8603
isFixedPoint
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8604
    "return true, if the receiver is some kind of fixedPoint number;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8605
     false is returned here - the method is only redefined in FixedPoint."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8606
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8607
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8608
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8609
    "Created: 5.11.1996 / 19:23:04 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8610
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8611
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8612
isFixedSize
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  8613
    "return true if the receiver cannot grow easily
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8614
     (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
  8615
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8616
    ^ true
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
6185
2029fdbadfde +isFloat
Claus Gittinger <cg@exept.de>
parents: 6182
diff changeset
  8619
isFloat
2029fdbadfde +isFloat
Claus Gittinger <cg@exept.de>
parents: 6182
diff changeset
  8620
    "return true, if the receiver is some kind of floating point number;
2029fdbadfde +isFloat
Claus Gittinger <cg@exept.de>
parents: 6182
diff changeset
  8621
     false is returned here.
2029fdbadfde +isFloat
Claus Gittinger <cg@exept.de>
parents: 6182
diff changeset
  8622
     Same as #isLimitedPrecisionReal, but a better name ;-)"
2029fdbadfde +isFloat
Claus Gittinger <cg@exept.de>
parents: 6182
diff changeset
  8623
2029fdbadfde +isFloat
Claus Gittinger <cg@exept.de>
parents: 6182
diff changeset
  8624
    ^ false
2029fdbadfde +isFloat
Claus Gittinger <cg@exept.de>
parents: 6182
diff changeset
  8625
2029fdbadfde +isFloat
Claus Gittinger <cg@exept.de>
parents: 6182
diff changeset
  8626
    "Modified: / 14.11.2001 / 14:57:46 / cg"
2029fdbadfde +isFloat
Claus Gittinger <cg@exept.de>
parents: 6182
diff changeset
  8627
!
2029fdbadfde +isFloat
Claus Gittinger <cg@exept.de>
parents: 6182
diff changeset
  8628
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8629
isForm
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8630
    "return true, if the receiver is some kind of form;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8631
     false is returned here - the method is only redefined in Form."
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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8636
isFraction
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8637
    "return true, if the receiver is some kind of fraction;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8638
     false is returned here - the method is only redefined in Fraction."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8639
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8640
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8641
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8642
9293
307bb63a9057 category change
Claus Gittinger <cg@exept.de>
parents: 9279
diff changeset
  8643
isHierarchicalItem
307bb63a9057 category change
Claus Gittinger <cg@exept.de>
parents: 9279
diff changeset
  8644
    "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
  8645
307bb63a9057 category change
Claus Gittinger <cg@exept.de>
parents: 9279
diff changeset
  8646
    ^ false
307bb63a9057 category change
Claus Gittinger <cg@exept.de>
parents: 9279
diff changeset
  8647
!
307bb63a9057 category change
Claus Gittinger <cg@exept.de>
parents: 9279
diff changeset
  8648
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8649
isImage
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8650
    "return true, if the receiver is some kind of image;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8651
     false is returned here - the method is only redefined in Image."
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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8656
isImageOrForm
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8657
    "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
  8658
     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
  8659
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8660
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8661
!
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
isImmediate
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8664
    "return true if I am an immediate object
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8665
     i.e. I am represented in the pointer itself and
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8666
     no real object header/storage is used me.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8667
     (currently, only SmallIntegers, some characters and nil return true)"
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
    ^ self class hasImmediateInstances
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8670
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8671
    "Created: 3.6.1997 / 12:00:18 / cg"
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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8674
isInteger
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8675
    "return true, if the receiver is some kind of integer number;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8676
     false is returned here - the method is only redefined in Integer."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8677
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8678
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8679
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8680
9279
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  8681
isInterestConverter
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  8682
    "return true if I am a kind of interest forwarder"
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  8683
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  8684
    ^ false
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  8685
!
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  8686
10576
60526e4a6854 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10567
diff changeset
  8687
isInternalByteStream
60526e4a6854 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10567
diff changeset
  8688
    "return true, if the receiver is some kind of Stream for reading bytes;
60526e4a6854 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10567
diff changeset
  8689
     false is returned here - the method is only redefined in PeekableStream."
60526e4a6854 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10567
diff changeset
  8690
60526e4a6854 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10567
diff changeset
  8691
    ^false
60526e4a6854 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10567
diff changeset
  8692
60526e4a6854 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10567
diff changeset
  8693
    "Created: / 30-05-2007 / 16:15:33 / cg"
60526e4a6854 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10567
diff changeset
  8694
!
60526e4a6854 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10567
diff changeset
  8695
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8696
isJavaClass
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8697
    "return true, if this is a javaClass.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8698
     false is returned here - the method is only redefined in JavaClass."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8699
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8700
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8701
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8702
    "Created: / 26.3.1997 / 13:34:54 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8703
    "Modified: / 8.5.1998 / 21:25:21 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8704
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8705
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8706
isJavaClassRef
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8707
    "return true, if this is a JavaClassRef.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8708
     false is returned here - the method is only redefined in JavaClassRef."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8709
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8710
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8711
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8712
    "Modified: / 8.5.1998 / 21:25:46 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8713
    "Created: / 24.12.1999 / 01:46:28 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8714
!
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
isJavaContext
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8717
    "return true, if this is a javaContext.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8718
     false is returned here - the method is only redefined in JavaContext."
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
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8721
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8722
    "Created: / 8.5.1998 / 21:24:27 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8723
    "Modified: / 8.5.1998 / 21:25:35 / cg"
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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8726
isJavaMethod
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8727
    "return true, if this is a JavaMethod.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8728
     false is returned here - the method is only redefined in JavaMethod."
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
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8731
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8732
    "Modified: / 8.5.1998 / 21:25:46 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8733
    "Created: / 25.9.1999 / 23:26:12 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8734
!
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
isJavaMethodRef
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8737
    "return true, if this is a JavaMethodRef.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8738
     false is returned here - the method is only redefined in JavaMethodRef."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8739
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8740
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8741
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8742
    "Modified: / 8.5.1998 / 21:25:46 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8743
    "Created: / 23.12.1999 / 19:44:51 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8744
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8745
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8746
isJavaObject
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8747
    "return true, if this is a javaObject.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8748
     false is returned here - the method is only redefined in JavaObject."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8749
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8750
    ^ false
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
    "Created: / 26.3.1997 / 13:34:48 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8753
    "Modified: / 8.5.1998 / 21:25:46 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8754
!
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
isJavaScriptClass
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8757
    "return true, if this is a javaScriptClass.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8758
     false is returned here - the method is only redefined in JavaScriptClass."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8759
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8760
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8761
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8762
8935
f770c55ba40e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8934
diff changeset
  8763
isJavaScriptMetaclass
f770c55ba40e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8934
diff changeset
  8764
    "return true, if this is a javaScript Metaclass.
f770c55ba40e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8934
diff changeset
  8765
     false is returned here - the method is only redefined in JavaScriptMetaclass."
f770c55ba40e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8934
diff changeset
  8766
f770c55ba40e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8934
diff changeset
  8767
    ^ false
f770c55ba40e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8934
diff changeset
  8768
!
f770c55ba40e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8934
diff changeset
  8769
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8770
isKindOf:aClass
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8771
    "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
  8772
     subclasses, false otherwise.
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  8773
     Advice:
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  8774
        use of this to check objects for certain attributes/protocoll should
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  8775
        be avoided; it limits the reusability of your classes by limiting use
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  8776
        to instances of certain classes and fences you into a specific inheritance
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  8777
        hierarchy.
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  8778
        Use check-methods to check an object for a certain attributes/protocol
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  8779
        (such as #isXXXX, #respondsTo: or #isNumber).
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  8780
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  8781
        Using #isKindOf: is considered BAD STYLE.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8782
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8783
     Advice2:
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  8784
        Be aware, that using an #isXXX method is usually much faster than
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  8785
        using #isKindOf:; because isKindOf: has to walk up all the superclass
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  8786
        hierarchy, comparing every class on the way.
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  8787
        Due to caching in the VM, a call to #isXXX is normally reached via
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  8788
        a single function call.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8789
     "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8790
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8791
%{  /* NOCONTEXT */
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8792
    register OBJ thisClass;
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
    thisClass = __Class(self);
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8795
    while (thisClass != nil) {
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  8796
        if (thisClass == aClass) {
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  8797
            RETURN ( true );
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  8798
        }
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  8799
        thisClass = __ClassInstPtr(thisClass)->c_superclass;
5755
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
    RETURN ( false );
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8802
%}
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8803
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8804
"/
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8805
"/  the above code is equivalent to:
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8806
"/
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8807
"/  thisClass := self class.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8808
"/  [thisClass notNil] whileTrue:[
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8809
"/      thisClass == aClass ifTrue:[^ true].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8810
"/      thisClass := thisClass superclass
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
"/  ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8813
"/
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8814
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8815
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8816
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8817
isLayout
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8818
    "return true, if the receiver is some kind of layout;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8819
     false is returned here - the method is only redefined in Layout."
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
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8822
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8823
6567
cba5c3103600 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6549
diff changeset
  8824
isLazyValue
cba5c3103600 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6549
diff changeset
  8825
    ^ false
cba5c3103600 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6549
diff changeset
  8826
!
cba5c3103600 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6549
diff changeset
  8827
6086
0bd476397581 added isLimitedPrecisionReal
Claus Gittinger <cg@exept.de>
parents: 6074
diff changeset
  8828
isLimitedPrecisionReal
0bd476397581 added isLimitedPrecisionReal
Claus Gittinger <cg@exept.de>
parents: 6074
diff changeset
  8829
    "return true, if the receiver is some kind of floating point number;
0bd476397581 added isLimitedPrecisionReal
Claus Gittinger <cg@exept.de>
parents: 6074
diff changeset
  8830
     false is returned here - the method is only redefined in LimitedPrecisionReal."
0bd476397581 added isLimitedPrecisionReal
Claus Gittinger <cg@exept.de>
parents: 6074
diff changeset
  8831
0bd476397581 added isLimitedPrecisionReal
Claus Gittinger <cg@exept.de>
parents: 6074
diff changeset
  8832
    ^ false
0bd476397581 added isLimitedPrecisionReal
Claus Gittinger <cg@exept.de>
parents: 6074
diff changeset
  8833
!
0bd476397581 added isLimitedPrecisionReal
Claus Gittinger <cg@exept.de>
parents: 6074
diff changeset
  8834
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8835
isList
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8836
    "return true, if the receiver is some kind of list collection;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8837
     false is returned here - the method is only redefined in List."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8838
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8839
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8840
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8841
    "Created: / 11.2.2000 / 01:37:05 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8842
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8843
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8844
isLiteral
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8845
    "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
  8846
     false is returned here - the method is redefined in some classes."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8847
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8848
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8849
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8850
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8851
isMemberOf:aClass
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8852
    "return true, if the receiver is an instance of aClass, false otherwise.
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  8853
     Advice:
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  8854
        use of this to check objects for certain attributes/protocol should
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  8855
        be avoided; it limits the reusability of your classes by limiting use
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  8856
        to instances of a certain class.
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  8857
        Use check-methods to check an object for a certain attributes/protocol
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  8858
        (such as #isXXX, #respondsTo: or #isNumber);
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  8859
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  8860
        Using #isMemberOf: is considered BAD STYLE.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8861
     Notice:
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  8862
        This method is open coded (inlined) by the compiler(s)
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  8863
        - redefining it may not work as expected."
5755
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
    ^ (self class) == aClass
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8866
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8867
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8868
isMeta
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8869
    "return true, if the receiver is some kind of metaclass;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8870
     false is returned here - the method is only redefined in Metaclass."
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
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8873
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8874
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8875
isMethod
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8876
    "return true, if the receiver is some kind of method;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8877
     false returned here - the method is only redefined in Method."
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
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8880
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8881
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8882
isMorph
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8883
    "return true, if the receiver is some kind of morph;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8884
     false is returned here - the method is only redefined in Morph."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8885
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8886
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8887
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8888
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8889
isNameSpace
9221
d8fff4a78065 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9216
diff changeset
  8890
    "return true, if the receiver is a nameSpace.
d8fff4a78065 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9216
diff changeset
  8891
     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
  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
    "Created: / 11.10.1996 / 18:08:56 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8896
    "Modified: / 8.5.1998 / 21:26:05 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8897
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8898
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8899
isNamespace
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8900
    "return true, if this is a nameSpace.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8901
     false is returned here - the method is only redefined in Namespace."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8902
5869
362be80efcb9 Use <resource:#obsolete>
Stefan Vogel <sv@exept.de>
parents: 5856
diff changeset
  8903
    <resource:#obsolete>
362be80efcb9 Use <resource:#obsolete>
Stefan Vogel <sv@exept.de>
parents: 5856
diff changeset
  8904
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8905
    self obsoleteMethodWarning:'use #isNameSpace'.
6805
f95ad1a82775 *** empty log message ***
ca
parents: 6800
diff changeset
  8906
    ^ self isNameSpace
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8907
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8908
6068
1d5ca1175f3f added #isNilOrEmptyCollection
Claus Gittinger <cg@exept.de>
parents: 6033
diff changeset
  8909
isNil
9221
d8fff4a78065 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9216
diff changeset
  8910
    "Return true, if the receiver is nil.
d8fff4a78065 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9216
diff changeset
  8911
     Because isNil is redefined in UndefinedObject,
d8fff4a78065 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9216
diff changeset
  8912
     the receiver is definitely not nil here, so unconditionally return false.
6068
1d5ca1175f3f added #isNilOrEmptyCollection
Claus Gittinger <cg@exept.de>
parents: 6033
diff changeset
  8913
     Notice:
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  8914
        This method is open coded (inlined) by the compiler(s)
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  8915
        - redefining it may not work as expected."
6068
1d5ca1175f3f added #isNilOrEmptyCollection
Claus Gittinger <cg@exept.de>
parents: 6033
diff changeset
  8916
1d5ca1175f3f added #isNilOrEmptyCollection
Claus Gittinger <cg@exept.de>
parents: 6033
diff changeset
  8917
    ^ false
1d5ca1175f3f added #isNilOrEmptyCollection
Claus Gittinger <cg@exept.de>
parents: 6033
diff changeset
  8918
!
1d5ca1175f3f added #isNilOrEmptyCollection
Claus Gittinger <cg@exept.de>
parents: 6033
diff changeset
  8919
1d5ca1175f3f added #isNilOrEmptyCollection
Claus Gittinger <cg@exept.de>
parents: 6033
diff changeset
  8920
isNilOrEmptyCollection
6182
2b992cf865bc comment
Claus Gittinger <cg@exept.de>
parents: 6181
diff changeset
  8921
    "return true if I am nil or an empty collection - false here.
8833
717b01292d0e comments
Stefan Vogel <sv@exept.de>
parents: 8832
diff changeset
  8922
     Obsolete, use isEmptyOrNil."
717b01292d0e comments
Stefan Vogel <sv@exept.de>
parents: 8832
diff changeset
  8923
717b01292d0e comments
Stefan Vogel <sv@exept.de>
parents: 8832
diff changeset
  8924
    <resource:#obsolete>
6068
1d5ca1175f3f added #isNilOrEmptyCollection
Claus Gittinger <cg@exept.de>
parents: 6033
diff changeset
  8925
1d5ca1175f3f added #isNilOrEmptyCollection
Claus Gittinger <cg@exept.de>
parents: 6033
diff changeset
  8926
    ^ false
6182
2b992cf865bc comment
Claus Gittinger <cg@exept.de>
parents: 6181
diff changeset
  8927
2b992cf865bc comment
Claus Gittinger <cg@exept.de>
parents: 6181
diff changeset
  8928
    "Modified: / 13.11.2001 / 13:28:06 / cg"
6068
1d5ca1175f3f added #isNilOrEmptyCollection
Claus Gittinger <cg@exept.de>
parents: 6033
diff changeset
  8929
!
1d5ca1175f3f added #isNilOrEmptyCollection
Claus Gittinger <cg@exept.de>
parents: 6033
diff changeset
  8930
9005
b82aa6bdc487 #isNonByteCollection
Stefan Vogel <sv@exept.de>
parents: 8986
diff changeset
  8931
isNonByteCollection
b82aa6bdc487 #isNonByteCollection
Stefan Vogel <sv@exept.de>
parents: 8986
diff changeset
  8932
    "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
  8933
     false is returned here - the method is redefined in Collection and UninterpretedBytes."
b82aa6bdc487 #isNonByteCollection
Stefan Vogel <sv@exept.de>
parents: 8986
diff changeset
  8934
b82aa6bdc487 #isNonByteCollection
Stefan Vogel <sv@exept.de>
parents: 8986
diff changeset
  8935
    ^ false
b82aa6bdc487 #isNonByteCollection
Stefan Vogel <sv@exept.de>
parents: 8986
diff changeset
  8936
b82aa6bdc487 #isNonByteCollection
Stefan Vogel <sv@exept.de>
parents: 8986
diff changeset
  8937
    "
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  8938
        21 isNonByteCollection
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  8939
        'abc' isNonByteCollection
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  8940
        #'abc' isNonByteCollection
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  8941
        #[1 2 3] isNonByteCollection
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  8942
        #(1 2 3) isNonByteCollection
9005
b82aa6bdc487 #isNonByteCollection
Stefan Vogel <sv@exept.de>
parents: 8986
diff changeset
  8943
    "
b82aa6bdc487 #isNonByteCollection
Stefan Vogel <sv@exept.de>
parents: 8986
diff changeset
  8944
!
b82aa6bdc487 #isNonByteCollection
Stefan Vogel <sv@exept.de>
parents: 8986
diff changeset
  8945
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8946
isNumber
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8947
    "return true, if the receiver is some kind of number;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8948
     false is returned here - the method is only redefined in Number."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8949
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8950
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8951
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8952
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8953
isOrderedCollection
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8954
    "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
  8955
     false is returned here - the method is only redefined in OrderedCollection."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8956
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8957
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8958
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8959
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8960
isPoint
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8961
    "return true, if the receiver is some kind of point;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8962
     false is returned here - the method is only redefined in Point."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8963
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8964
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8965
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8966
10532
36237807e16a + #isPrinterContext
fm
parents: 10530
diff changeset
  8967
isPrinterContext
36237807e16a + #isPrinterContext
fm
parents: 10530
diff changeset
  8968
36237807e16a + #isPrinterContext
fm
parents: 10530
diff changeset
  8969
    ^false
36237807e16a + #isPrinterContext
fm
parents: 10530
diff changeset
  8970
!
36237807e16a + #isPrinterContext
fm
parents: 10530
diff changeset
  8971
13416
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  8972
isProgrammingLanguage
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  8973
    "return true, if the receiver is a programming language.
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  8974
     False is returned here - the method is only redefined in 
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  8975
     ProgrammingLanguage."
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  8976
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  8977
    ^ false
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  8978
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  8979
    "Created: / 21-07-2010 / 15:13:50 / Jan Vrany <jan.vrany@fit.cvut.cz>"
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  8980
!
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  8981
9515
89c8275e009a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9509
diff changeset
  8982
isProjectDefinition
89c8275e009a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9509
diff changeset
  8983
    "return true, if the receiver is a projectDefinition.
89c8275e009a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9509
diff changeset
  8984
     False is returned here - the method is only redefined in ProjectDefinition."
89c8275e009a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9509
diff changeset
  8985
89c8275e009a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9509
diff changeset
  8986
    ^ false
89c8275e009a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9509
diff changeset
  8987
89c8275e009a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9509
diff changeset
  8988
    "Created: / 10-08-2006 / 16:24:53 / cg"
89c8275e009a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9509
diff changeset
  8989
!
89c8275e009a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9509
diff changeset
  8990
13140
919308f42885 added: #isProxy
Claus Gittinger <cg@exept.de>
parents: 13136
diff changeset
  8991
isProxy
919308f42885 added: #isProxy
Claus Gittinger <cg@exept.de>
parents: 13136
diff changeset
  8992
    "return true, if the receiver is a proxy for another (lazy loaded) object.
919308f42885 added: #isProxy
Claus Gittinger <cg@exept.de>
parents: 13136
diff changeset
  8993
     False is returned here."
919308f42885 added: #isProxy
Claus Gittinger <cg@exept.de>
parents: 13136
diff changeset
  8994
919308f42885 added: #isProxy
Claus Gittinger <cg@exept.de>
parents: 13136
diff changeset
  8995
    ^ false
919308f42885 added: #isProxy
Claus Gittinger <cg@exept.de>
parents: 13136
diff changeset
  8996
919308f42885 added: #isProxy
Claus Gittinger <cg@exept.de>
parents: 13136
diff changeset
  8997
    "Created: / 21-11-2010 / 11:15:46 / cg"
919308f42885 added: #isProxy
Claus Gittinger <cg@exept.de>
parents: 13136
diff changeset
  8998
!
919308f42885 added: #isProxy
Claus Gittinger <cg@exept.de>
parents: 13136
diff changeset
  8999
10171
523c654f762b +isRealNameSpace
Claus Gittinger <cg@exept.de>
parents: 10062
diff changeset
  9000
isRealNameSpace
523c654f762b +isRealNameSpace
Claus Gittinger <cg@exept.de>
parents: 10062
diff changeset
  9001
    "return true, if the receiver is really a nameSpace (i.e. a NameSpace, but not Smalltalk).
523c654f762b +isRealNameSpace
Claus Gittinger <cg@exept.de>
parents: 10062
diff changeset
  9002
     False is returned here - the method is only redefined in Namespace."
523c654f762b +isRealNameSpace
Claus Gittinger <cg@exept.de>
parents: 10062
diff changeset
  9003
523c654f762b +isRealNameSpace
Claus Gittinger <cg@exept.de>
parents: 10062
diff changeset
  9004
    ^ false
523c654f762b +isRealNameSpace
Claus Gittinger <cg@exept.de>
parents: 10062
diff changeset
  9005
523c654f762b +isRealNameSpace
Claus Gittinger <cg@exept.de>
parents: 10062
diff changeset
  9006
    "Created: / 10-11-2006 / 17:05:43 / cg"
523c654f762b +isRealNameSpace
Claus Gittinger <cg@exept.de>
parents: 10062
diff changeset
  9007
!
523c654f762b +isRealNameSpace
Claus Gittinger <cg@exept.de>
parents: 10062
diff changeset
  9008
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9009
isRectangle
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9010
    "return true, if the receiver is some kind of rectangle;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9011
     false is returned here - the method is only redefined in Rectangle."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9012
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9013
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9014
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9015
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9016
isRemoteObject
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9017
    "return true, if the receiver is some kind of remoteObject,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9018
     false if its local - the method is only redefined in RemoteObject."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9019
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9020
    ^ false
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
    "Created: 28.10.1996 / 15:18:45 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9023
    "Modified: 28.10.1996 / 15:20:57 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9024
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9025
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9026
isSequenceable
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9027
    "return true, if the receiver is some kind of sequenceable collection;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9028
     false is returned here - the method is only redefined in SequenceableCollection."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9029
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9030
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9031
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9032
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9033
isSequenceableCollection
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9034
    "OBSOLETE: use isSequenceable for ST-80 compatibility.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9035
     This method is a historic leftover and will be removed soon ...
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9036
     (although its name is much better than #isSequenceable - sigh)"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9037
5869
362be80efcb9 Use <resource:#obsolete>
Stefan Vogel <sv@exept.de>
parents: 5856
diff changeset
  9038
    <resource:#obsolete>
362be80efcb9 Use <resource:#obsolete>
Stefan Vogel <sv@exept.de>
parents: 5856
diff changeset
  9039
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9040
    self obsoleteMethodWarning:'use #isSequenceable'.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9041
    ^ false
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
10856
d54db15b9761 +isSharedPool
Claus Gittinger <cg@exept.de>
parents: 10837
diff changeset
  9044
isSharedPool
d54db15b9761 +isSharedPool
Claus Gittinger <cg@exept.de>
parents: 10837
diff changeset
  9045
    "return true, if the receiver is a sharedPool.
d54db15b9761 +isSharedPool
Claus Gittinger <cg@exept.de>
parents: 10837
diff changeset
  9046
     False is returned here - the method is only redefined in SharedPool."
d54db15b9761 +isSharedPool
Claus Gittinger <cg@exept.de>
parents: 10837
diff changeset
  9047
d54db15b9761 +isSharedPool
Claus Gittinger <cg@exept.de>
parents: 10837
diff changeset
  9048
    ^ false
d54db15b9761 +isSharedPool
Claus Gittinger <cg@exept.de>
parents: 10837
diff changeset
  9049
!
d54db15b9761 +isSharedPool
Claus Gittinger <cg@exept.de>
parents: 10837
diff changeset
  9050
13565
4c0a9ea3a4e1 added: #isSpecialInstrumentationInfoLiteral
Claus Gittinger <cg@exept.de>
parents: 13515
diff changeset
  9051
isSpecialInstrumentationInfoLiteral
4c0a9ea3a4e1 added: #isSpecialInstrumentationInfoLiteral
Claus Gittinger <cg@exept.de>
parents: 13515
diff changeset
  9052
    "return true, if the receiver is a special instrumentation info
4c0a9ea3a4e1 added: #isSpecialInstrumentationInfoLiteral
Claus Gittinger <cg@exept.de>
parents: 13515
diff changeset
  9053
     object as placed into the literal array of instrumented methods"
4c0a9ea3a4e1 added: #isSpecialInstrumentationInfoLiteral
Claus Gittinger <cg@exept.de>
parents: 13515
diff changeset
  9054
4c0a9ea3a4e1 added: #isSpecialInstrumentationInfoLiteral
Claus Gittinger <cg@exept.de>
parents: 13515
diff changeset
  9055
    ^ false
4c0a9ea3a4e1 added: #isSpecialInstrumentationInfoLiteral
Claus Gittinger <cg@exept.de>
parents: 13515
diff changeset
  9056
4c0a9ea3a4e1 added: #isSpecialInstrumentationInfoLiteral
Claus Gittinger <cg@exept.de>
parents: 13515
diff changeset
  9057
    "Created: / 07-08-2011 / 17:03:41 / cg"
4c0a9ea3a4e1 added: #isSpecialInstrumentationInfoLiteral
Claus Gittinger <cg@exept.de>
parents: 13515
diff changeset
  9058
!
4c0a9ea3a4e1 added: #isSpecialInstrumentationInfoLiteral
Claus Gittinger <cg@exept.de>
parents: 13515
diff changeset
  9059
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9060
isStream
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9061
    "return true, if the receiver is some kind of stream;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9062
     false is returned here - the method is only redefined in Stream."
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
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9065
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9066
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9067
isString
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9068
    "return true, if the receiver is some kind of string;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9069
     false is returned here - the method is only redefined in CharacterArray."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9070
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9071
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9072
!
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
isStringCollection
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9075
    "return true, if the receiver is some kind of stringCollection;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9076
     false is returned here - the method is only redefined in StringCollection."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9077
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9078
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9079
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9080
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9081
isSymbol
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9082
    "return true, if the receiver is some kind of symbol;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9083
     false is returned here - the method is only redefined in Symbol."
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
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9086
!
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
isText
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9089
    "return true, if the receiver is some kind of text object;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9090
     false is returned here - the method is only redefined in Text."
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
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9093
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9094
    "Created: 12.5.1996 / 10:56:50 / cg"
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
13656
46e673aac938 added: #isTextView
Claus Gittinger <cg@exept.de>
parents: 13626
diff changeset
  9097
isTextView
46e673aac938 added: #isTextView
Claus Gittinger <cg@exept.de>
parents: 13626
diff changeset
  9098
    "return true, if the receiver is some kind of textView;
46e673aac938 added: #isTextView
Claus Gittinger <cg@exept.de>
parents: 13626
diff changeset
  9099
     false is returned here - the method is only redefined in TextViews."
46e673aac938 added: #isTextView
Claus Gittinger <cg@exept.de>
parents: 13626
diff changeset
  9100
46e673aac938 added: #isTextView
Claus Gittinger <cg@exept.de>
parents: 13626
diff changeset
  9101
    ^ false
46e673aac938 added: #isTextView
Claus Gittinger <cg@exept.de>
parents: 13626
diff changeset
  9102
46e673aac938 added: #isTextView
Claus Gittinger <cg@exept.de>
parents: 13626
diff changeset
  9103
    "Modified (comment): / 08-09-2011 / 05:12:37 / cg"
46e673aac938 added: #isTextView
Claus Gittinger <cg@exept.de>
parents: 13626
diff changeset
  9104
!
46e673aac938 added: #isTextView
Claus Gittinger <cg@exept.de>
parents: 13626
diff changeset
  9105
13229
187ab17bc43d added: #isTimestamp
Stefan Vogel <sv@exept.de>
parents: 13190
diff changeset
  9106
isTimestamp
187ab17bc43d added: #isTimestamp
Stefan Vogel <sv@exept.de>
parents: 13190
diff changeset
  9107
    ^ false
187ab17bc43d added: #isTimestamp
Stefan Vogel <sv@exept.de>
parents: 13190
diff changeset
  9108
!
187ab17bc43d added: #isTimestamp
Stefan Vogel <sv@exept.de>
parents: 13190
diff changeset
  9109
13626
057aa930d735 added: #isTrait
Claus Gittinger <cg@exept.de>
parents: 13578
diff changeset
  9110
isTrait
057aa930d735 added: #isTrait
Claus Gittinger <cg@exept.de>
parents: 13578
diff changeset
  9111
    "Return true if the receiver is a trait.
057aa930d735 added: #isTrait
Claus Gittinger <cg@exept.de>
parents: 13578
diff changeset
  9112
     Note: Do not override in any class except TraitBehavior."
057aa930d735 added: #isTrait
Claus Gittinger <cg@exept.de>
parents: 13578
diff changeset
  9113
057aa930d735 added: #isTrait
Claus Gittinger <cg@exept.de>
parents: 13578
diff changeset
  9114
    ^ false
057aa930d735 added: #isTrait
Claus Gittinger <cg@exept.de>
parents: 13578
diff changeset
  9115
057aa930d735 added: #isTrait
Claus Gittinger <cg@exept.de>
parents: 13578
diff changeset
  9116
    "Created: / 04-09-2011 / 20:04:43 / cg"
057aa930d735 added: #isTrait
Claus Gittinger <cg@exept.de>
parents: 13578
diff changeset
  9117
!
057aa930d735 added: #isTrait
Claus Gittinger <cg@exept.de>
parents: 13578
diff changeset
  9118
14296
fe82bc5091f9 added: #isUUID
Stefan Vogel <sv@exept.de>
parents: 14292
diff changeset
  9119
isUUID
fe82bc5091f9 added: #isUUID
Stefan Vogel <sv@exept.de>
parents: 14292
diff changeset
  9120
    ^ false
fe82bc5091f9 added: #isUUID
Stefan Vogel <sv@exept.de>
parents: 14292
diff changeset
  9121
!
fe82bc5091f9 added: #isUUID
Stefan Vogel <sv@exept.de>
parents: 14292
diff changeset
  9122
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9123
isValueModel
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9124
    "return true, if the receiver is some kind of valueModel;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9125
     false is returned here - the method is only redefined in ValueModel."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9126
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9127
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9128
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9129
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9130
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9131
isVariable
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9132
    "return true if the receiver has indexed instance variables,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9133
     false otherwise."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9134
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9135
    ^ self class isVariable
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9136
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9137
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9138
isVariableBinding
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9139
    "return true, if this is a binding for a variable.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9140
     false is returned here - the method is only redefined in Binding."
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
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9143
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9144
    "Created: / 19.6.1997 / 17:38:44 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9145
    "Modified: / 8.5.1998 / 21:26:55 / cg"
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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9148
isView
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9149
    "return true, if the receiver is some kind of view;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9150
     false is returned here - the method is only redefined in View."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9151
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9152
    ^ false
6068
1d5ca1175f3f added #isNilOrEmptyCollection
Claus Gittinger <cg@exept.de>
parents: 6033
diff changeset
  9153
!
1d5ca1175f3f added #isNilOrEmptyCollection
Claus Gittinger <cg@exept.de>
parents: 6033
diff changeset
  9154
6932
1e1d296d4747 + #notEmptyOrNil
penk
parents: 6926
diff changeset
  9155
notEmptyOrNil
1e1d296d4747 + #notEmptyOrNil
penk
parents: 6926
diff changeset
  9156
    "Squeak compatibility:
1e1d296d4747 + #notEmptyOrNil
penk
parents: 6926
diff changeset
  9157
     return true if I am neither nil nor an empty collection.
1e1d296d4747 + #notEmptyOrNil
penk
parents: 6926
diff changeset
  9158
     Return true here."
1e1d296d4747 + #notEmptyOrNil
penk
parents: 6926
diff changeset
  9159
1e1d296d4747 + #notEmptyOrNil
penk
parents: 6926
diff changeset
  9160
    ^ true
1e1d296d4747 + #notEmptyOrNil
penk
parents: 6926
diff changeset
  9161
!
1e1d296d4747 + #notEmptyOrNil
penk
parents: 6926
diff changeset
  9162
6068
1d5ca1175f3f added #isNilOrEmptyCollection
Claus Gittinger <cg@exept.de>
parents: 6033
diff changeset
  9163
notNil
9221
d8fff4a78065 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9216
diff changeset
  9164
    "Return true, if the receiver is not nil.
d8fff4a78065 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9216
diff changeset
  9165
     Because notNil is redefined in UndefinedObject,
d8fff4a78065 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9216
diff changeset
  9166
     the receiver is definitely not nil here, so unconditionally return true.
6068
1d5ca1175f3f added #isNilOrEmptyCollection
Claus Gittinger <cg@exept.de>
parents: 6033
diff changeset
  9167
     Notice:
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  9168
        This method is open coded (inlined) by the compiler(s)
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  9169
        - redefining it may not work as expected."
6068
1d5ca1175f3f added #isNilOrEmptyCollection
Claus Gittinger <cg@exept.de>
parents: 6033
diff changeset
  9170
1d5ca1175f3f added #isNilOrEmptyCollection
Claus Gittinger <cg@exept.de>
parents: 6033
diff changeset
  9171
    ^ true
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9172
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9173
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9174
!Object methodsFor:'tracing'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9175
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9176
traceInto:aRequestor level:level from:referrer
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9177
    "double dispatch into tracer, passing my type implicitely in the selector"
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
    ^ aRequestor traceObject:self level:level from:referrer
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9180
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9181
    "Created: / 2.9.1999 / 09:05:17 / stefan"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9182
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9183
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9184
!Object methodsFor:'user interaction & notifications'!
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
activityNotification:aString
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9187
    "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
  9188
     some long-time activity.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9189
     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
  9190
     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
  9191
     and proceed. If there is no handler, this is simply ignored.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9192
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9193
     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
  9194
     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
  9195
     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
  9196
8330
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
  9197
    ActivityNotification isHandled ifTrue:[
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  9198
        ^ ActivityNotification raiseRequestWith:self errorString:aString
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9199
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9200
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9201
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9202
     nil activityNotification:'hello there'
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9203
     self activityNotification:'hello there'
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9204
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9205
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9206
    "
8330
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
  9207
     ActivityNotification handle:[:ex |
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  9208
        ex errorString printCR.
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  9209
        ex proceed.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9210
     ] do:[
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  9211
        'hello' printCR.
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  9212
        self activityNotification:'doing some long time computation'.
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  9213
        'world' printCR.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9214
     ]
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9215
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9216
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9217
    "Modified: 16.12.1995 / 18:23:42 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9218
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9219
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9220
confirm:aString
9694
64f6face84d5 comment
Claus Gittinger <cg@exept.de>
parents: 9657
diff changeset
  9221
    "open a modal yes-no dialog.
64f6face84d5 comment
Claus Gittinger <cg@exept.de>
parents: 9657
diff changeset
  9222
     Return true for yes, false for no.
10527
b783c0000f54 #confirm: now uses the UserConfirmation otification to request an answer
Stefan Vogel <sv@exept.de>
parents: 10480
diff changeset
  9223
     If no GUI is present (headless applications), true is returned.
b783c0000f54 #confirm: now uses the UserConfirmation otification to request an answer
Stefan Vogel <sv@exept.de>
parents: 10480
diff changeset
  9224
b783c0000f54 #confirm: now uses the UserConfirmation otification to request an answer
Stefan Vogel <sv@exept.de>
parents: 10480
diff changeset
  9225
     Someone in the sender chain may redefine the confirmation handler
b783c0000f54 #confirm: now uses the UserConfirmation otification to request an answer
Stefan Vogel <sv@exept.de>
parents: 10480
diff changeset
  9226
     by handling the UserConfirmation."
b783c0000f54 #confirm: now uses the UserConfirmation otification to request an answer
Stefan Vogel <sv@exept.de>
parents: 10480
diff changeset
  9227
b783c0000f54 #confirm: now uses the UserConfirmation otification to request an answer
Stefan Vogel <sv@exept.de>
parents: 10480
diff changeset
  9228
    ^ UserConfirmation raiseRequestErrorString:aString
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  9229
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9230
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9231
     nil confirm:'hello'
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9232
     self confirm:'hello'
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9233
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9234
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9235
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9236
confirm:aString orCancel:cancelBlock
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9237
    "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
  9238
     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
  9239
     If no GUI is present (headless applications), cancelBlock is returned."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9240
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9241
    |answer|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9242
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9243
    answer := self confirmWithCancel:aString.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9244
    answer isNil ifTrue:[
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  9245
        ^ cancelBlock value
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9246
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9247
    ^ answer
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  9248
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9249
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9250
     self confirm:'hello' orCancel:[self halt]
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9251
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9252
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9253
    "Modified: 20.5.1996 / 10:28:40 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9254
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9255
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9256
confirmWithCancel:aString
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9257
    "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
  9258
     return true for yes, false for no, nil for cancel.
10527
b783c0000f54 #confirm: now uses the UserConfirmation otification to request an answer
Stefan Vogel <sv@exept.de>
parents: 10480
diff changeset
  9259
     If no GUI is present (headless applications), nil is returned.
b783c0000f54 #confirm: now uses the UserConfirmation otification to request an answer
Stefan Vogel <sv@exept.de>
parents: 10480
diff changeset
  9260
b783c0000f54 #confirm: now uses the UserConfirmation otification to request an answer
Stefan Vogel <sv@exept.de>
parents: 10480
diff changeset
  9261
     Someone in the sender chain may redefine the confirmation handler
b783c0000f54 #confirm: now uses the UserConfirmation otification to request an answer
Stefan Vogel <sv@exept.de>
parents: 10480
diff changeset
  9262
     by handling the UserConfirmation."
b783c0000f54 #confirm: now uses the UserConfirmation otification to request an answer
Stefan Vogel <sv@exept.de>
parents: 10480
diff changeset
  9263
11366
97a8331d3e4c + confirmWithCancel defaultAnswer
Claus Gittinger <cg@exept.de>
parents: 11339
diff changeset
  9264
    ^ self confirmWithCancel:aString defaultAnswer:nil
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  9265
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  9266
    "
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  9267
     nil confirmWithCancel:'hello'
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9268
     self confirmWithCancel:'hello'
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9269
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9270
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9271
11366
97a8331d3e4c + confirmWithCancel defaultAnswer
Claus Gittinger <cg@exept.de>
parents: 11339
diff changeset
  9272
confirmWithCancel:aString defaultAnswer:defaultAnswerOrNil
97a8331d3e4c + confirmWithCancel defaultAnswer
Claus Gittinger <cg@exept.de>
parents: 11339
diff changeset
  9273
    "launch a confirmer, which allows user to enter yes, no or cancel.
97a8331d3e4c + confirmWithCancel defaultAnswer
Claus Gittinger <cg@exept.de>
parents: 11339
diff changeset
  9274
     return true for yes, false for no, nil for cancel.
97a8331d3e4c + confirmWithCancel defaultAnswer
Claus Gittinger <cg@exept.de>
parents: 11339
diff changeset
  9275
     If no GUI is present (headless applications), nil is returned.
97a8331d3e4c + confirmWithCancel defaultAnswer
Claus Gittinger <cg@exept.de>
parents: 11339
diff changeset
  9276
97a8331d3e4c + confirmWithCancel defaultAnswer
Claus Gittinger <cg@exept.de>
parents: 11339
diff changeset
  9277
     Someone in the sender chain may redefine the confirmation handler
97a8331d3e4c + confirmWithCancel defaultAnswer
Claus Gittinger <cg@exept.de>
parents: 11339
diff changeset
  9278
     by handling the UserConfirmation."
97a8331d3e4c + confirmWithCancel defaultAnswer
Claus Gittinger <cg@exept.de>
parents: 11339
diff changeset
  9279
97a8331d3e4c + confirmWithCancel defaultAnswer
Claus Gittinger <cg@exept.de>
parents: 11339
diff changeset
  9280
    ^ UserConfirmation new
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  9281
        defaultAnswer:defaultAnswerOrNil;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  9282
        canCancel:true;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  9283
        errorString:aString;
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  9284
        raiseRequest
11366
97a8331d3e4c + confirmWithCancel defaultAnswer
Claus Gittinger <cg@exept.de>
parents: 11339
diff changeset
  9285
97a8331d3e4c + confirmWithCancel defaultAnswer
Claus Gittinger <cg@exept.de>
parents: 11339
diff changeset
  9286
    "
97a8331d3e4c + confirmWithCancel defaultAnswer
Claus Gittinger <cg@exept.de>
parents: 11339
diff changeset
  9287
     nil confirmWithCancel:'hello' defaultAnswer:true
97a8331d3e4c + confirmWithCancel defaultAnswer
Claus Gittinger <cg@exept.de>
parents: 11339
diff changeset
  9288
     self confirmWithCancel:'hello' defaultAnswer:false
97a8331d3e4c + confirmWithCancel defaultAnswer
Claus Gittinger <cg@exept.de>
parents: 11339
diff changeset
  9289
    "
97a8331d3e4c + confirmWithCancel defaultAnswer
Claus Gittinger <cg@exept.de>
parents: 11339
diff changeset
  9290
!
97a8331d3e4c + confirmWithCancel defaultAnswer
Claus Gittinger <cg@exept.de>
parents: 11339
diff changeset
  9291
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9292
errorNotify:aString
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9293
    "launch a Notifier, showing top stack, telling user something
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9294
     and give user a chance to enter debugger."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9295
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9296
    ^ self
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  9297
        errorNotify:aString
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  9298
        from:thisContext sender
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  9299
        allowDebug:true
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 errorNotify:'hello there'
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9303
     self errorNotify:'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
6199
5fcf06f17cee *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6196
diff changeset
  9306
    "Modified: / 16.11.2001 / 15:36:49 / cg"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9307
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9308
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9309
errorNotify:aString from:aContext
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  9310
    "launch a Notifier, showing top stack (above aContext),
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9311
     telling user something and give user a chance to enter debugger."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9312
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9313
    ^ self errorNotify:aString from:aContext allowDebug:true
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
    "Modified: / 17.8.1998 / 10:09:27 / cg"
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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9318
errorNotify:aString from:aContext allowDebug:allowDebug
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  9319
    "launch a Notifier, showing top stack (above aContext),
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9320
     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
  9321
11314
0b6e06b60ebe changed the error-notifier for standAlone apps.
Claus Gittinger <cg@exept.de>
parents: 11244
diff changeset
  9322
    |currentScreen con sender action boxLabels boxValues default s|
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9323
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9324
    Smalltalk isInitialized ifFalse:[
13566
fc4e1055263d changed: #errorNotify:from:allowDebug:
sr
parents: 13565
diff changeset
  9325
        'errorNotification: ' print. aString printCR.
fc4e1055263d changed: #errorNotify:from:allowDebug:
sr
parents: 13565
diff changeset
  9326
        aContext sender printAllLevels:10.
fc4e1055263d changed: #errorNotify:from:allowDebug:
sr
parents: 13565
diff changeset
  9327
        ^ nil
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  9328
    ].
11531
30f1ba816a81 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11530
diff changeset
  9329
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  9330
    (Dialog isNil
6647
79c298b93c07 #errorNotify -- allow copying the backtrace
Stefan Vogel <sv@exept.de>
parents: 6631
diff changeset
  9331
     or:[Screen isNil
79c298b93c07 #errorNotify -- allow copying the backtrace
Stefan Vogel <sv@exept.de>
parents: 6631
diff changeset
  9332
     or:[(currentScreen := Screen current) isNil
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  9333
     or:[currentScreen isOpen not]]]) ifTrue:[
13566
fc4e1055263d changed: #errorNotify:from:allowDebug:
sr
parents: 13565
diff changeset
  9334
        "
fc4e1055263d changed: #errorNotify:from:allowDebug:
sr
parents: 13565
diff changeset
  9335
         on systems without GUI, simply show
fc4e1055263d changed: #errorNotify:from:allowDebug:
sr
parents: 13565
diff changeset
  9336
         the message on the Transcript and abort.
fc4e1055263d changed: #errorNotify:from:allowDebug:
sr
parents: 13565
diff changeset
  9337
        "
fc4e1055263d changed: #errorNotify:from:allowDebug:
sr
parents: 13565
diff changeset
  9338
        Transcript showCR:aString.
fc4e1055263d changed: #errorNotify:from:allowDebug:
sr
parents: 13565
diff changeset
  9339
        AbortOperationRequest raise.
fc4e1055263d changed: #errorNotify:from:allowDebug:
sr
parents: 13565
diff changeset
  9340
        "not reached"
fc4e1055263d changed: #errorNotify:from:allowDebug:
sr
parents: 13565
diff changeset
  9341
        ^ nil
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9342
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9343
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9344
    Processor activeProcessIsSystemProcess ifTrue:[
13566
fc4e1055263d changed: #errorNotify:from:allowDebug:
sr
parents: 13565
diff changeset
  9345
        action := #debug.
fc4e1055263d changed: #errorNotify:from:allowDebug:
sr
parents: 13565
diff changeset
  9346
        sender := aContext.
fc4e1055263d changed: #errorNotify:from:allowDebug:
sr
parents: 13565
diff changeset
  9347
        Debugger isNil ifTrue:[
fc4e1055263d changed: #errorNotify:from:allowDebug:
sr
parents: 13565
diff changeset
  9348
            '****************** Cought Error while in SystemProcess ****************' errorPrintCR.
13846
1bf1e7a7554a changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13845
diff changeset
  9349
            aString errorPrintCR.
13566
fc4e1055263d changed: #errorNotify:from:allowDebug:
sr
parents: 13565
diff changeset
  9350
            Exception handle:[:ex |
13844
f03a655457f4 changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13812
diff changeset
  9351
                'Cought recursive error while printing backtrace:' errorPrintCR.
f03a655457f4 changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13812
diff changeset
  9352
                ex description errorPrintCR.
13566
fc4e1055263d changed: #errorNotify:from:allowDebug:
sr
parents: 13565
diff changeset
  9353
            ] do:[
fc4e1055263d changed: #errorNotify:from:allowDebug:
sr
parents: 13565
diff changeset
  9354
                thisContext fullPrintAll.
fc4e1055263d changed: #errorNotify:from:allowDebug:
sr
parents: 13565
diff changeset
  9355
            ].
fc4e1055263d changed: #errorNotify:from:allowDebug:
sr
parents: 13565
diff changeset
  9356
            action := #abort.
fc4e1055263d changed: #errorNotify:from:allowDebug:
sr
parents: 13565
diff changeset
  9357
        ].
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9358
    ] ifFalse:[
13566
fc4e1055263d changed: #errorNotify:from:allowDebug:
sr
parents: 13565
diff changeset
  9359
        Dialog autoload.        "in case it's autoloaded"
fc4e1055263d changed: #errorNotify:from:allowDebug:
sr
parents: 13565
diff changeset
  9360
fc4e1055263d changed: #errorNotify:from:allowDebug:
sr
parents: 13565
diff changeset
  9361
        Error handle:[:ex |
fc4e1055263d changed: #errorNotify:from:allowDebug:
sr
parents: 13565
diff changeset
  9362
            "/ a recursive error - quickly enter debugger
fc4e1055263d changed: #errorNotify:from:allowDebug:
sr
parents: 13565
diff changeset
  9363
            "/ this happened, when I corrupted the Dialog class ...
fc4e1055263d changed: #errorNotify:from:allowDebug:
sr
parents: 13565
diff changeset
  9364
            ('Object [error]: ' , ex description , ' caught in errorNotification') errorPrintCR.
fc4e1055263d changed: #errorNotify:from:allowDebug:
sr
parents: 13565
diff changeset
  9365
            action := #debug.
fc4e1055263d changed: #errorNotify:from:allowDebug:
sr
parents: 13565
diff changeset
  9366
            ex return.
fc4e1055263d changed: #errorNotify:from:allowDebug:
sr
parents: 13565
diff changeset
  9367
        ] do:[ |s|
fc4e1055263d changed: #errorNotify:from:allowDebug:
sr
parents: 13565
diff changeset
  9368
            sender := aContext.
fc4e1055263d changed: #errorNotify:from:allowDebug:
sr
parents: 13565
diff changeset
  9369
            sender isNil ifTrue:[
fc4e1055263d changed: #errorNotify:from:allowDebug:
sr
parents: 13565
diff changeset
  9370
                sender := thisContext sender.
fc4e1055263d changed: #errorNotify:from:allowDebug:
sr
parents: 13565
diff changeset
  9371
            ].
fc4e1055263d changed: #errorNotify:from:allowDebug:
sr
parents: 13565
diff changeset
  9372
            con := sender.
fc4e1055263d changed: #errorNotify:from:allowDebug:
sr
parents: 13565
diff changeset
  9373
fc4e1055263d changed: #errorNotify:from:allowDebug:
sr
parents: 13565
diff changeset
  9374
            "/ skip intermediate (signal & exception) contexts
fc4e1055263d changed: #errorNotify:from:allowDebug:
sr
parents: 13565
diff changeset
  9375
            DebugView notNil ifTrue:[
fc4e1055263d changed: #errorNotify:from:allowDebug:
sr
parents: 13565
diff changeset
  9376
                con := DebugView interestingContextFrom:sender
fc4e1055263d changed: #errorNotify:from:allowDebug:
sr
parents: 13565
diff changeset
  9377
            ].
fc4e1055263d changed: #errorNotify:from:allowDebug:
sr
parents: 13565
diff changeset
  9378
fc4e1055263d changed: #errorNotify:from:allowDebug:
sr
parents: 13565
diff changeset
  9379
            "/ show the first few contexts
fc4e1055263d changed: #errorNotify:from:allowDebug:
sr
parents: 13565
diff changeset
  9380
fc4e1055263d changed: #errorNotify:from:allowDebug:
sr
parents: 13565
diff changeset
  9381
            s := WriteStream with:aString.
fc4e1055263d changed: #errorNotify:from:allowDebug:
sr
parents: 13565
diff changeset
  9382
            s cr; cr.
fc4e1055263d changed: #errorNotify:from:allowDebug:
sr
parents: 13565
diff changeset
  9383
            s nextPutLine:'Calling Chain:'.
fc4e1055263d changed: #errorNotify:from:allowDebug:
sr
parents: 13565
diff changeset
  9384
            s nextPutLine:'--------------------------------------------------------------'.
fc4e1055263d changed: #errorNotify:from:allowDebug:
sr
parents: 13565
diff changeset
  9385
            1 to:25 do:[:n |
fc4e1055263d changed: #errorNotify:from:allowDebug:
sr
parents: 13565
diff changeset
  9386
                con notNil ifTrue:[
fc4e1055263d changed: #errorNotify:from:allowDebug:
sr
parents: 13565
diff changeset
  9387
                    con printOn:s.
fc4e1055263d changed: #errorNotify:from:allowDebug:
sr
parents: 13565
diff changeset
  9388
                    s cr.
fc4e1055263d changed: #errorNotify:from:allowDebug:
sr
parents: 13565
diff changeset
  9389
                    con := con sender
fc4e1055263d changed: #errorNotify:from:allowDebug:
sr
parents: 13565
diff changeset
  9390
                ]
fc4e1055263d changed: #errorNotify:from:allowDebug:
sr
parents: 13565
diff changeset
  9391
            ].
fc4e1055263d changed: #errorNotify:from:allowDebug:
sr
parents: 13565
diff changeset
  9392
fc4e1055263d changed: #errorNotify:from:allowDebug:
sr
parents: 13565
diff changeset
  9393
            boxLabels := #('Proceed').
fc4e1055263d changed: #errorNotify:from:allowDebug:
sr
parents: 13565
diff changeset
  9394
            boxValues := #(#proceed).
fc4e1055263d changed: #errorNotify:from:allowDebug:
sr
parents: 13565
diff changeset
  9395
            default := #proceed.
fc4e1055263d changed: #errorNotify:from:allowDebug:
sr
parents: 13565
diff changeset
  9396
fc4e1055263d changed: #errorNotify:from:allowDebug:
sr
parents: 13565
diff changeset
  9397
            AbortOperationRequest isHandled ifTrue:[
fc4e1055263d changed: #errorNotify:from:allowDebug:
sr
parents: 13565
diff changeset
  9398
                default := #abort.
fc4e1055263d changed: #errorNotify:from:allowDebug:
sr
parents: 13565
diff changeset
  9399
                boxLabels := boxLabels , #('Abort').
fc4e1055263d changed: #errorNotify:from:allowDebug:
sr
parents: 13565
diff changeset
  9400
                boxValues := boxValues , #(#abort).
fc4e1055263d changed: #errorNotify:from:allowDebug:
sr
parents: 13565
diff changeset
  9401
                true "allowDebug" ifTrue:[
fc4e1055263d changed: #errorNotify:from:allowDebug:
sr
parents: 13565
diff changeset
  9402
                    boxLabels := boxLabels , #('Copy Trace and Abort').
fc4e1055263d changed: #errorNotify:from:allowDebug:
sr
parents: 13565
diff changeset
  9403
                    boxValues := boxValues , #(#copyAndAbort).
fc4e1055263d changed: #errorNotify:from:allowDebug:
sr
parents: 13565
diff changeset
  9404
                ]
fc4e1055263d changed: #errorNotify:from:allowDebug:
sr
parents: 13565
diff changeset
  9405
            ] ifFalse:[
fc4e1055263d changed: #errorNotify:from:allowDebug:
sr
parents: 13565
diff changeset
  9406
                true "allowDebug" ifTrue:[
fc4e1055263d changed: #errorNotify:from:allowDebug:
sr
parents: 13565
diff changeset
  9407
                    boxLabels := boxLabels , #('Copy Trace and Proceed').
fc4e1055263d changed: #errorNotify:from:allowDebug:
sr
parents: 13565
diff changeset
  9408
                    boxValues := boxValues , #(#copyAndProceed).
fc4e1055263d changed: #errorNotify:from:allowDebug:
sr
parents: 13565
diff changeset
  9409
                ].
fc4e1055263d changed: #errorNotify:from:allowDebug:
sr
parents: 13565
diff changeset
  9410
            ].
fc4e1055263d changed: #errorNotify:from:allowDebug:
sr
parents: 13565
diff changeset
  9411
fc4e1055263d changed: #errorNotify:from:allowDebug:
sr
parents: 13565
diff changeset
  9412
            (allowDebug and:[Debugger notNil]) ifTrue:[
fc4e1055263d changed: #errorNotify:from:allowDebug:
sr
parents: 13565
diff changeset
  9413
                boxLabels := boxLabels , #('Debug').
fc4e1055263d changed: #errorNotify:from:allowDebug:
sr
parents: 13565
diff changeset
  9414
                boxValues := boxValues , #(#debug).
fc4e1055263d changed: #errorNotify:from:allowDebug:
sr
parents: 13565
diff changeset
  9415
                default := #debug.
fc4e1055263d changed: #errorNotify:from:allowDebug:
sr
parents: 13565
diff changeset
  9416
            ].
fc4e1055263d changed: #errorNotify:from:allowDebug:
sr
parents: 13565
diff changeset
  9417
fc4e1055263d changed: #errorNotify:from:allowDebug:
sr
parents: 13565
diff changeset
  9418
            action := Dialog
fc4e1055263d changed: #errorNotify:from:allowDebug:
sr
parents: 13565
diff changeset
  9419
                    choose:s contents
fc4e1055263d changed: #errorNotify:from:allowDebug:
sr
parents: 13565
diff changeset
  9420
                    label:('Exception [' , Processor activeProcess nameOrId , ']')
fc4e1055263d changed: #errorNotify:from:allowDebug:
sr
parents: 13565
diff changeset
  9421
                    image:WarningBox errorIconBitmap
fc4e1055263d changed: #errorNotify:from:allowDebug:
sr
parents: 13565
diff changeset
  9422
                    labels:boxLabels
fc4e1055263d changed: #errorNotify:from:allowDebug:
sr
parents: 13565
diff changeset
  9423
                    values:boxValues
fc4e1055263d changed: #errorNotify:from:allowDebug:
sr
parents: 13565
diff changeset
  9424
                    default:default
fc4e1055263d changed: #errorNotify:from:allowDebug:
sr
parents: 13565
diff changeset
  9425
                    onCancel:nil.
fc4e1055263d changed: #errorNotify:from:allowDebug:
sr
parents: 13565
diff changeset
  9426
        ].
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9427
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9428
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9429
    action == #debug ifTrue:[
13566
fc4e1055263d changed: #errorNotify:from:allowDebug:
sr
parents: 13565
diff changeset
  9430
        ^ Debugger enter:sender withMessage:aString mayProceed:true
11236
c196f9dedf66 exception description in debugger
Claus Gittinger <cg@exept.de>
parents: 11221
diff changeset
  9431
    ].
c196f9dedf66 exception description in debugger
Claus Gittinger <cg@exept.de>
parents: 11221
diff changeset
  9432
    action == #proceed ifTrue:[
13566
fc4e1055263d changed: #errorNotify:from:allowDebug:
sr
parents: 13565
diff changeset
  9433
        ^ nil.
11335
c061d08b766f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11314
diff changeset
  9434
    ].
c061d08b766f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11314
diff changeset
  9435
    (action == #copyAndProceed
c061d08b766f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11314
diff changeset
  9436
    or:[action == #copyAndAbort]) ifTrue:[
13566
fc4e1055263d changed: #errorNotify:from:allowDebug:
sr
parents: 13565
diff changeset
  9437
        s := '' writeStream.
fc4e1055263d changed: #errorNotify:from:allowDebug:
sr
parents: 13565
diff changeset
  9438
        Exception handle:[:ex |
fc4e1055263d changed: #errorNotify:from:allowDebug:
sr
parents: 13565
diff changeset
  9439
            'Cought recursive error while printing backtrace' errorPrintCR.
fc4e1055263d changed: #errorNotify:from:allowDebug:
sr
parents: 13565
diff changeset
  9440
        ] do:[
fc4e1055263d changed: #errorNotify:from:allowDebug:
sr
parents: 13565
diff changeset
  9441
            sender fullPrintAllOn:s.
fc4e1055263d changed: #errorNotify:from:allowDebug:
sr
parents: 13565
diff changeset
  9442
        ].
fc4e1055263d changed: #errorNotify:from:allowDebug:
sr
parents: 13565
diff changeset
  9443
        currentScreen rootView setClipboardText:s contents.
fc4e1055263d changed: #errorNotify:from:allowDebug:
sr
parents: 13565
diff changeset
  9444
        action == #copyAndProceed ifTrue:[
fc4e1055263d changed: #errorNotify:from:allowDebug:
sr
parents: 13565
diff changeset
  9445
            ^ nil
fc4e1055263d changed: #errorNotify:from:allowDebug:
sr
parents: 13565
diff changeset
  9446
        ].
11314
0b6e06b60ebe changed the error-notifier for standAlone apps.
Claus Gittinger <cg@exept.de>
parents: 11244
diff changeset
  9447
    ].
0b6e06b60ebe changed the error-notifier for standAlone apps.
Claus Gittinger <cg@exept.de>
parents: 11244
diff changeset
  9448
11236
c196f9dedf66 exception description in debugger
Claus Gittinger <cg@exept.de>
parents: 11221
diff changeset
  9449
    AbortOperationRequest raise.
c196f9dedf66 exception description in debugger
Claus Gittinger <cg@exept.de>
parents: 11221
diff changeset
  9450
    "not reached"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9451
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9452
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9453
     nil errorNotify:'hello there'
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9454
     self errorNotify:'hello there'
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9455
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9456
13165
66a6b37405d1 changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13162
diff changeset
  9457
    "Created: / 17-08-1998 / 10:09:26 / cg"
13566
fc4e1055263d changed: #errorNotify:from:allowDebug:
sr
parents: 13565
diff changeset
  9458
    "Modified: / 08-08-2011 / 11:26:17 / sr"
13844
f03a655457f4 changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13812
diff changeset
  9459
    "Modified: / 05-12-2011 / 03:50:59 / cg"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9460
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9461
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9462
information:aString
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  9463
    "launch an InfoBox, telling user something.
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  9464
     These info-boxes can be suppressed by handling
7033
c4183ea85a71 Now Warning is a subclass of UserNotification.
Stefan Vogel <sv@exept.de>
parents: 7031
diff changeset
  9465
     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
  9466
     Use #notify: for more important messages.
8371
4493f5ac7405 *** empty log message ***
ca
parents: 8330
diff changeset
  9467
     If nobody handles the exception, the default action of UserNotification
10527
b783c0000f54 #confirm: now uses the UserConfirmation otification to request an answer
Stefan Vogel <sv@exept.de>
parents: 10480
diff changeset
  9468
     pops up an info dialog."
7033
c4183ea85a71 Now Warning is a subclass of UserNotification.
Stefan Vogel <sv@exept.de>
parents: 7031
diff changeset
  9469
7035
1d049fb7ae5a Make UserInformation a class based exception
Stefan Vogel <sv@exept.de>
parents: 7033
diff changeset
  9470
    UserInformation raiseRequestWith:self errorString:aString
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9471
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9472
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9473
     nil information:'hello there'
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9474
     self information:'hello there'
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9475
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9476
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9477
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9478
     InformationSignal handle:[:ex |
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  9479
        'no box popped' printCR.
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  9480
        ex proceed.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9481
     ] do:[
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  9482
        'hello' printCR.
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  9483
        self information:'some info'.
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  9484
        'world' printCR.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9485
     ]
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9486
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9487
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9488
    "Modified: 24.11.1995 / 22:29:49 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9489
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9490
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9491
notify:aString
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9492
    "launch a Notifier, telling user something.
7033
c4183ea85a71 Now Warning is a subclass of UserNotification.
Stefan Vogel <sv@exept.de>
parents: 7031
diff changeset
  9493
     Use #information: for ignorable messages.
c4183ea85a71 Now Warning is a subclass of UserNotification.
Stefan Vogel <sv@exept.de>
parents: 7031
diff changeset
  9494
     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
  9495
     pops up a warn dialog."
c4183ea85a71 Now Warning is a subclass of UserNotification.
Stefan Vogel <sv@exept.de>
parents: 7031
diff changeset
  9496
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9497
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9498
    Smalltalk isInitialized ifFalse:[
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  9499
        "/ thisContext fullPrintAll.
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  9500
        'information: ' print. aString printCR.
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  9501
        ^ self
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9502
    ].
7033
c4183ea85a71 Now Warning is a subclass of UserNotification.
Stefan Vogel <sv@exept.de>
parents: 7031
diff changeset
  9503
    UserNotification raiseRequestWith:self errorString:aString.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9504
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9505
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9506
     nil notify:'hello there'
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9507
     self notify:'hello there'
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9508
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9509
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9510
    "Modified: 20.5.1996 / 10:28:48 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9511
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9512
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9513
warn:aString
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9514
    "launch a WarningBox, telling user something.
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  9515
     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
  9516
     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
  9517
     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
  9518
     pops up a warn dialog."
c4183ea85a71 Now Warning is a subclass of UserNotification.
Stefan Vogel <sv@exept.de>
parents: 7031
diff changeset
  9519
c4183ea85a71 Now Warning is a subclass of UserNotification.
Stefan Vogel <sv@exept.de>
parents: 7031
diff changeset
  9520
    Warning raiseRequestWith:self errorString:aString
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9521
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9522
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9523
     nil warn:'hello there'
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9524
     self warn:'hello there'
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9525
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9526
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9527
    "
7033
c4183ea85a71 Now Warning is a subclass of UserNotification.
Stefan Vogel <sv@exept.de>
parents: 7031
diff changeset
  9528
     Warning handle:[:ex |
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  9529
        Transcript showCR:ex description.
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  9530
        ex proceed.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9531
     ] do:[
13845
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  9532
        'hello' printCR.
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  9533
        self warn:'some info'.
2bea2acfe75b changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13844
diff changeset
  9534
        'world' printCR.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9535
     ]
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9536
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9537
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9538
    "Modified: 20.5.1996 / 10:28:53 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9539
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9540
8397
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  9541
!Object methodsFor:'visiting'!
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  9542
8426
b4195c5f9450 +acceptVisitor
Claus Gittinger <cg@exept.de>
parents: 8413
diff changeset
  9543
acceptVisitor:aVisitor
b4195c5f9450 +acceptVisitor
Claus Gittinger <cg@exept.de>
parents: 8413
diff changeset
  9544
    "double-dispatch onto a Visitor."
b4195c5f9450 +acceptVisitor
Claus Gittinger <cg@exept.de>
parents: 8413
diff changeset
  9545
b4195c5f9450 +acceptVisitor
Claus Gittinger <cg@exept.de>
parents: 8413
diff changeset
  9546
    ^ self acceptVisitor:aVisitor with:nil
b4195c5f9450 +acceptVisitor
Claus Gittinger <cg@exept.de>
parents: 8413
diff changeset
  9547
!
b4195c5f9450 +acceptVisitor
Claus Gittinger <cg@exept.de>
parents: 8413
diff changeset
  9548
8397
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  9549
acceptVisitor:aVisitor with:aParameter
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  9550
    "double-dispatch onto a Visitor.
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  9551
     Subclasses redefine this"
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  9552
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  9553
    ^ aVisitor visitObject:self with:aParameter
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  9554
! !
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  9555
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9556
!Object class methodsFor:'documentation'!
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  9557
14056
24d7f7bf46c7 inspector2TabForBasicInspect
Claus Gittinger <cg@exept.de>
parents: 14055
diff changeset
  9558
version
14532
f15633aab0fe class: Object
Stefan Vogel <sv@exept.de>
parents: 14527
diff changeset
  9559
    ^ '$Header: /cvs/stx/stx/libbasic/Object.st,v 1.702 2012-11-24 12:53:02 stefan Exp $'
14056
24d7f7bf46c7 inspector2TabForBasicInspect
Claus Gittinger <cg@exept.de>
parents: 14055
diff changeset
  9560
!
24d7f7bf46c7 inspector2TabForBasicInspect
Claus Gittinger <cg@exept.de>
parents: 14055
diff changeset
  9561
12050
bd0013f79e4f added: #notYetImplemented
Claus Gittinger <cg@exept.de>
parents: 11976
diff changeset
  9562
version_CVS
14532
f15633aab0fe class: Object
Stefan Vogel <sv@exept.de>
parents: 14527
diff changeset
  9563
    ^ '$Header: /cvs/stx/stx/libbasic/Object.st,v 1.702 2012-11-24 12:53:02 stefan Exp $'
13416
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  9564
!
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  9565
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  9566
version_SVN
13487
bc1f569fcf4f changed: #inspect
Claus Gittinger <cg@exept.de>
parents: 13416
diff changeset
  9567
    ^ '§ Id: Object.st 10643 2011-06-08 21:53:07Z vranyj1  §'
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  9568
! !
6764
c5455cf45678 perform:withOptional*
Claus Gittinger <cg@exept.de>
parents: 6741
diff changeset
  9569
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9570
Object initialize!