Object.st
author Stefan Vogel <sv@exept.de>
Tue, 21 Jun 2016 23:15:13 +0200
changeset 20027 5be764ee44fb
parent 19846 08805f2c0810
child 20061 473654cd3470
child 20079 8d884971c2ed
permissions -rw-r--r--
#FEATURE by stefan class: Object added: #userInterruptIn:from: removed: #userInterruptIn: changed: #userInterrupt ditinguishe user interrupt generators
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
20027
5be764ee44fb #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 19846
diff changeset
     1
"{ Encoding: utf8 }"
5be764ee44fb #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 19846
diff changeset
     2
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
     3
"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
     4
 COPYRIGHT (c) 1988 by Claus Gittinger
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
     5
              All Rights Reserved
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
     6
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
     7
 This software is furnished under a license and may be used
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
     8
 only in accordance with the terms of that license and with the
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
     9
 inclusion of the above copyright notice.   This software may not
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    10
 be provided or otherwise made available to, or used by, any
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    11
 other person.  No title to or ownership of the software is
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    12
 hereby transferred.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    13
"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    14
"{ Package: 'stx:libbasic' }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    15
17261
a9bf1e05e5a2 class: Object
Claus Gittinger <cg@exept.de>
parents: 17176
diff changeset
    16
"{ NameSpace: Smalltalk }"
a9bf1e05e5a2 class: Object
Claus Gittinger <cg@exept.de>
parents: 17176
diff changeset
    17
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    18
nil subclass:#Object
20027
5be764ee44fb #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 19846
diff changeset
    19
	instanceVariableNames:''
5be764ee44fb #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 19846
diff changeset
    20
	classVariableNames:'AbortAllSignal AbortSignal ActivityNotificationSignal
5be764ee44fb #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 19846
diff changeset
    21
		DebuggerHooks DeepCopyErrorSignal Dependencies
5be764ee44fb #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 19846
diff changeset
    22
		ElementOutOfBoundsSignal EnabledBreakPoints ErrorRecursion
5be764ee44fb #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 19846
diff changeset
    23
		ErrorSignal FinalizationLobby HaltSignal IndexNotFoundSignal
5be764ee44fb #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 19846
diff changeset
    24
		InfoPrinting InformationSignal InternalErrorSignal
5be764ee44fb #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 19846
diff changeset
    25
		KeyNotFoundSignal MessageNotUnderstoodSignal
5be764ee44fb #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 19846
diff changeset
    26
		NonIntegerIndexSignal NonWeakDependencies NotFoundSignal
5be764ee44fb #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 19846
diff changeset
    27
		OSSignalInterruptSignal ObjectAttributes
5be764ee44fb #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 19846
diff changeset
    28
		ObjectAttributesAccessLock PrimitiveFailureSignal
5be764ee44fb #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 19846
diff changeset
    29
		RecursionInterruptSignal RecursiveStoreStringSignal
5be764ee44fb #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 19846
diff changeset
    30
		SubscriptOutOfBoundsSignal SynchronizationSemaphores
5be764ee44fb #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 19846
diff changeset
    31
		UserInterruptSignal UserNotificationSignal WarningSignal'
5be764ee44fb #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 19846
diff changeset
    32
	poolDictionaries:''
5be764ee44fb #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 19846
diff changeset
    33
	category:'Kernel-Objects'
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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    36
!Object class methodsFor:'documentation'!
3023
674376809496 general listView support (#displayOn / widthOn / heightOn)
ca
parents: 3010
diff changeset
    37
5754
333aba8041c2 checkin from browser
tm
parents: 5706
diff changeset
    38
copyright
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    39
"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    40
 COPYRIGHT (c) 1988 by Claus Gittinger
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
    41
              All Rights Reserved
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    42
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    43
 This software is furnished under a license and may be used
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    44
 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
    45
 inclusion of the above copyright notice.   This software may not
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    46
 be provided or otherwise made available to, or used by, any
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    47
 other person.  No title to or ownership of the software is
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    48
 hereby transferred.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    49
"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    50
!
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
dependencies
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    53
"
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
    54
   ST/X dependencies are slightly modified from ST-80's
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    55
   (we think they are better ;-).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    56
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    57
   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
    58
   cannot be garbage collected because some dependency is present,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    59
   having the object as a dependent of some other object.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    60
   In ST-80, this association remains alive (because a Dictionary
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    61
   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
    62
   to dependent or the dependee.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    63
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    64
   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
    65
   prevent memory leaks.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    66
   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
    67
   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
    68
   need to care about dependencies.
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
    69
   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
    70
   something that the programmer considers a dead object ?
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    71
   (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
    72
    that behavior)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    73
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    74
   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
    75
   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
    76
   so these dependents go away, once the model is reclaimed.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    77
   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
    78
   needed, with general objects it is mandatory.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    79
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    80
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    81
   In ST/X, dependencies are implemented using a WeakDictionary; this means,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    82
   that once the dependee dies, the dependency association is removed automatically,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    83
   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
    84
   references exist to the dependent.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    85
   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
    86
   (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
    87
   protocol to add nonWeak dependencies is provided
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    88
   (see #addNonWeakDependent / #removeNonWeakDependent).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    89
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    90
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    91
   Caveat:
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    92
      since interests are implemented using InterestConverter (which are simply
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    93
      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
    94
      automatically).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    95
      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
    96
      and those would be reclaimed if stored in a weakDictionary.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    97
      This means, that those interests MUST be removed with #retractInterest
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
    98
      (which is bug-compatible to ST-80).
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    99
      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
   100
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   101
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   102
   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
   103
"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   104
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   105
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   106
documentation
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   107
"
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
   108
   Object is the superclass of most other classes.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   109
   (except for nil-subclasses, which inherit nothing,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   110
    to catch any message into their #doesNotUnderstand: method)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   111
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   112
   Protocol which is common to every object is defined here.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   113
   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
   114
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   115
   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
   116
   UndefinedObject and SmallInteger are also inheriting from Object - these two cannot
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
   117
   have instance variables (due to their implementation).
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
   118
   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
   119
   classes (think of Class, Method, Block and also Integer or Float).
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
   120
   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
   121
   (and also rewritten in some places).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   122
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   123
   [Class variables:]
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   124
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   125
        ErrorSignal     <Signal>        Signal raised for error/error: messages
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   126
                                        also, parent of all other signals.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   127
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   128
        HaltSignal      <Signal>        Signal raised for halt/halt: messages
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   129
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   130
        MessageNotUnderstoodSignal      Signals raised for various error conditions
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   131
        UserInterruptSignal
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   132
        RecursionInterruptSignal
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   133
        ExceptionInterruptSignal
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   134
        SubscriptOutOfBoundsSignal
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   135
        NonIntegerIndexSignal
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   136
        NotFoundSignal
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   137
        KeyNotFoundSignal
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   138
        ElementOutOfBoundsSignal
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   139
        InformationSignal
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   140
        WarningSignal
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   141
        DeepCopyErrorSignal
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   142
        InternalErrorSignal
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   143
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   144
        AbortSignal      <Signal>       Signal raised by debugger, to abort a computation
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   145
                                        BUT, the debugger will only raise it if it is handled.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   146
                                        By handling the abortSignal, you can control where the
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   147
                                        debuggers abort-function resumes execution in case of
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   148
                                        an error.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   149
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   150
        ErrorRecursion   <Boolean>      controls behavior when recursive errors occur (i.e.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   151
                                        an error while handling an error).
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   152
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   153
        Dependencies     <WeakDependencyDictionary>
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   154
                                        keeps track of object dependencies.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   155
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   156
        InfoPrinting     <Boolean>      controls weather informational messages
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   157
                                        are printed.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   158
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   159
        ActivityNotificationSignal <QuerySignal>
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   160
                                         raised on #activityNotification:
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   161
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   162
        NonWeakDependencies <Dictionary> keeps track of object dependencies.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   163
                                         Dependents stay alive.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   164
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   165
        SynchronizationSemaphores <WeakIdentityDictionary>
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   166
                                         Semaphores for per-object-monitor.
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
   167
5755
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
    [author:]
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   170
        Claus Gittinger
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   171
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   172
"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   173
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   174
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   175
!Object class methodsFor:'initialization'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   176
5971
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   177
initSignals
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   178
    "called only once - initialize signals"
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   179
15193
e84b5268e918 class: Object
Claus Gittinger <cg@exept.de>
parents: 15128
diff changeset
   180
    "/ notice: the class variables here are a leftover from times
e84b5268e918 class: Object
Claus Gittinger <cg@exept.de>
parents: 15128
diff changeset
   181
    "/ when errors where signal-instance, not class based.
e84b5268e918 class: Object
Claus Gittinger <cg@exept.de>
parents: 15128
diff changeset
   182
    "/ then, signal instances where created here and kept as class vars,
e84b5268e918 class: Object
Claus Gittinger <cg@exept.de>
parents: 15128
diff changeset
   183
    "/ to be fetched from the class var or via signal-getter methods.
15586
ac2e51b3000c class: Object
Claus Gittinger <cg@exept.de>
parents: 15519
diff changeset
   184
    "/ Nowadays, we use class based exceptions, where the exception class
15193
e84b5268e918 class: Object
Claus Gittinger <cg@exept.de>
parents: 15128
diff changeset
   185
    "/ is directly referenced.
e84b5268e918 class: Object
Claus Gittinger <cg@exept.de>
parents: 15128
diff changeset
   186
    "/ the classvars here are kept for backward compatibility, but they now
e84b5268e918 class: Object
Claus Gittinger <cg@exept.de>
parents: 15128
diff changeset
   187
    "/ simply alias the corresponding exception class.
e84b5268e918 class: Object
Claus Gittinger <cg@exept.de>
parents: 15128
diff changeset
   188
    "/ Old code should be rewritten to access the error class.
e84b5268e918 class: Object
Claus Gittinger <cg@exept.de>
parents: 15128
diff changeset
   189
5971
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   190
    ErrorSignal := Error.
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   191
    HaltSignal := HaltInterrupt.
5977
1aa80a42ed64 more class based exceptions
Claus Gittinger <cg@exept.de>
parents: 5971
diff changeset
   192
    MessageNotUnderstoodSignal := MessageNotUnderstood.
6000
d6fbafc5879e more class based exceptions
Claus Gittinger <cg@exept.de>
parents: 5995
diff changeset
   193
    PrimitiveFailureSignal := PrimitiveFailure.
8330
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
   194
    InternalErrorSignal := VMInternalError.
5971
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   195
    UserInterruptSignal := UserInterrupt.
6146
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   196
    RecursionInterruptSignal := RecursionError.
5977
1aa80a42ed64 more class based exceptions
Claus Gittinger <cg@exept.de>
parents: 5971
diff changeset
   197
    NotFoundSignal := NotFoundError.
1aa80a42ed64 more class based exceptions
Claus Gittinger <cg@exept.de>
parents: 5971
diff changeset
   198
    IndexNotFoundSignal := IndexNotFoundError.
1aa80a42ed64 more class based exceptions
Claus Gittinger <cg@exept.de>
parents: 5971
diff changeset
   199
    SubscriptOutOfBoundsSignal := SubscriptOutOfBoundsError.
1aa80a42ed64 more class based exceptions
Claus Gittinger <cg@exept.de>
parents: 5971
diff changeset
   200
    NonIntegerIndexSignal := NonIntegerIndexError.
8330
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
   201
    KeyNotFoundSignal := KeyNotFoundError.
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
   202
    ElementOutOfBoundsSignal := ElementBoundsError.
7033
c4183ea85a71 Now Warning is a subclass of UserNotification.
Stefan Vogel <sv@exept.de>
parents: 7031
diff changeset
   203
    UserNotificationSignal := UserNotification.
c4183ea85a71 Now Warning is a subclass of UserNotification.
Stefan Vogel <sv@exept.de>
parents: 7031
diff changeset
   204
    WarningSignal := Warning.
7035
1d049fb7ae5a Make UserInformation a class based exception
Stefan Vogel <sv@exept.de>
parents: 7033
diff changeset
   205
    InformationSignal := UserInformation.
8330
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
   206
    ActivityNotificationSignal := ActivityNotification.
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
   207
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
   208
    DeepCopyErrorSignal := DeepCopyError.
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
   209
6203
d39d75849383 class based exceptions - abortSignal
Claus Gittinger <cg@exept.de>
parents: 6199
diff changeset
   210
    AbortSignal := AbortOperationRequest.
6877
ab4e7d42f9f8 AbortAllOperation - now class based
Claus Gittinger <cg@exept.de>
parents: 6874
diff changeset
   211
    AbortAllSignal := AbortAllOperationRequest.
8330
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
   212
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
   213
    OSSignalInterruptSignal := OSSignalInterrupt.
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
   214
    RecursiveStoreStringSignal := RecursiveStoreError.
5971
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   215
5980
5fd29de6d596 more class based exceptions
Claus Gittinger <cg@exept.de>
parents: 5977
diff changeset
   216
    "
5fd29de6d596 more class based exceptions
Claus Gittinger <cg@exept.de>
parents: 5977
diff changeset
   217
     Object initSignals
5fd29de6d596 more class based exceptions
Claus Gittinger <cg@exept.de>
parents: 5977
diff changeset
   218
    "
5971
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   219
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   220
    "Modified: / 22.1.1998 / 21:23:40 / av"
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   221
    "Modified: / 4.8.1999 / 08:54:06 / stefan"
6203
d39d75849383 class based exceptions - abortSignal
Claus Gittinger <cg@exept.de>
parents: 6199
diff changeset
   222
    "Modified: / 16.11.2001 / 16:30:08 / cg"
5971
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   223
!
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   224
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   225
initialize
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   226
    "called only once - initialize signals"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   227
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   228
    ErrorSignal isNil ifTrue:[
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   229
        self initSignals.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   230
        ErrorRecursion := true.
5971
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   231
    ].
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   232
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   233
    ObjectAttributes isNil ifTrue:[
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   234
        ObjectAttributes := WeakIdentityDictionary new.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   235
        ObjectAttributesAccessLock := RecursionLock new.
5971
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   236
    ].
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   237
    Dependencies isNil ifTrue:[
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   238
        Dependencies := WeakDependencyDictionary new.
5971
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   239
    ].
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   240
    NonWeakDependencies isNil ifTrue:[
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   241
        NonWeakDependencies := IdentityDictionary new.
5971
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   242
    ].
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   243
    SynchronizationSemaphores isNil ifTrue:[
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   244
        SynchronizationSemaphores := WeakIdentityDictionary new.
5971
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   245
    ].
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   246
    FinalizationLobby isNil ifTrue:[
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   247
        FinalizationLobby := Registry new.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   248
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   249
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   250
    "/ initialize InfoPrinting to the VM's infoPrint setting
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   251
    "/ (which can be turned off via a command line argument)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   252
    InfoPrinting := ObjectMemory infoPrinting.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   253
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   254
    "Object initialize"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   255
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   256
    "Modified: / 22.1.1998 / 21:23:40 / av"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   257
    "Modified: / 3.2.1998 / 18:55:09 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   258
    "Modified: / 4.8.1999 / 08:54:06 / stefan"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   259
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   260
20027
5be764ee44fb #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 19846
diff changeset
   261
7303
98111fb6a285 category
Claus Gittinger <cg@exept.de>
parents: 7285
diff changeset
   262
!Object class methodsFor:'Compatibility-ST80'!
5755
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
rootError
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   265
    "return the signal used for error/error: - handling.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   266
     Same as errorSignal for ST80 compatibility."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   267
7094
617eeaf2f8ba Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7081
diff changeset
   268
    ^ Error
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   269
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   270
    "Created: / 15.1.1998 / 23:47:05 / stefan"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   271
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   272
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   273
!Object class methodsFor:'Signal constants'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   274
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
   275
abortAllSignal
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   276
    "return the signal used to abort user actions (much like AbortSignal).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   277
     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
   278
     the loop (such as when confirming multiple class deletions etc.)"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   279
15903
7de2ea21e054 AbortSignal -> AbortOperationRequest
Stefan Vogel <sv@exept.de>
parents: 15891
diff changeset
   280
    ^ AbortAllOperationRequest
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   281
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   282
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
   283
abortSignal
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   284
    "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
   285
     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
   286
     currently active doIt/printIt or inspectIt. (also some others use
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   287
     this for a save abort)"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   288
8521
60f0e479ffc1 use class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8502
diff changeset
   289
    ^ AbortOperationRequest
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   290
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   291
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   292
activityNotificationSignal
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   293
    "return the signal used for activity notifications.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   294
     A handler for this signal gets all #activityNotification: sends"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   295
8330
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
   296
    ^ ActivityNotification
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
13416
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
   299
ambiguousMessageSignal
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
   300
    "return the signal used for ambiguousMessage: - error handling"
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
   301
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
   302
    ^ AmbiguousMessage
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
   303
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
   304
    "Created: / 21-07-2010 / 15:39:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
   305
!
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
   306
11132
e5bd3a66ca80 conversion errors (specific error classes)
Claus Gittinger <cg@exept.de>
parents: 11068
diff changeset
   307
conversionErrorSignal
e5bd3a66ca80 conversion errors (specific error classes)
Claus Gittinger <cg@exept.de>
parents: 11068
diff changeset
   308
    "return the signal used for conversion error handling"
e5bd3a66ca80 conversion errors (specific error classes)
Claus Gittinger <cg@exept.de>
parents: 11068
diff changeset
   309
e5bd3a66ca80 conversion errors (specific error classes)
Claus Gittinger <cg@exept.de>
parents: 11068
diff changeset
   310
    ^ ConversionError
e5bd3a66ca80 conversion errors (specific error classes)
Claus Gittinger <cg@exept.de>
parents: 11068
diff changeset
   311
!
e5bd3a66ca80 conversion errors (specific error classes)
Claus Gittinger <cg@exept.de>
parents: 11068
diff changeset
   312
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
   313
deepCopyErrorSignal
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   314
    "return the signal raised when a deepcopy is asked for
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   315
     an object which cannot do this (for example, BlockClosures
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   316
     or Contexts)."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   317
8330
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
   318
    ^ DeepCopyError
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   319
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   320
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   321
elementOutOfBoundsSignal
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   322
    "return the signal used for element error reporting
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   323
     (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
   324
      be put into a bytearray)"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   325
8330
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
   326
    ^ ElementBoundsError
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   327
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   328
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   329
errorSignal
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   330
    "return the signal used for error/error: - handling"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   331
7094
617eeaf2f8ba Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7081
diff changeset
   332
    ^ Error
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   333
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   334
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   335
haltSignal
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   336
    "return the signal used for halt/halt: - handling"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   337
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   338
    ^ HaltSignal
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   339
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   340
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   341
indexNotFoundSignal
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   342
    "return the signal used for bad index error reporting.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   343
     This is also the parentSignal of the nonIntegerIndex- and
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   344
     subscriptOutOfBoundsSignal"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   345
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   346
    ^ IndexNotFoundSignal
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
    "Created: / 8.11.1997 / 19:15:48 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   349
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   350
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
   351
informationSignal
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
   352
    "return the signal used for informations.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   353
     A handler for this signal gets all #information: sends"
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
    ^ InformationSignal
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   356
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   357
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   358
internalErrorSignal
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   359
    "return the signal used to report internal (VM-) errors."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   360
8330
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
   361
    ^ VMInternalError
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   362
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   363
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
   364
keyNotFoundSignal
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   365
    "return the signal used for no such key error reporting"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   366
8330
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
   367
    ^ KeyNotFoundError
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   368
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   369
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   370
messageNotUnderstoodSignal
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   371
    "return the signal used for doesNotUnderstand: - error handling"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   372
15193
e84b5268e918 class: Object
Claus Gittinger <cg@exept.de>
parents: 15128
diff changeset
   373
    ^ MessageNotUnderstood
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   374
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   375
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
   376
nonIntegerIndexSignal
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   377
    "return the signal used for bad subscript error reporting"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   378
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   379
    ^ NonIntegerIndexSignal
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   380
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   381
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
   382
notFoundSignal
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   383
    "return the signal used for no element found error reporting"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   384
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   385
    ^ NotFoundSignal
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   386
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   387
7644
211762a9a39f added notifySignal for VW compatibility
Claus Gittinger <cg@exept.de>
parents: 7621
diff changeset
   388
notifySignal
211762a9a39f added notifySignal for VW compatibility
Claus Gittinger <cg@exept.de>
parents: 7621
diff changeset
   389
    "return the parent of all notification signals."
211762a9a39f added notifySignal for VW compatibility
Claus Gittinger <cg@exept.de>
parents: 7621
diff changeset
   390
211762a9a39f added notifySignal for VW compatibility
Claus Gittinger <cg@exept.de>
parents: 7621
diff changeset
   391
    ^ Notification
211762a9a39f added notifySignal for VW compatibility
Claus Gittinger <cg@exept.de>
parents: 7621
diff changeset
   392
!
211762a9a39f added notifySignal for VW compatibility
Claus Gittinger <cg@exept.de>
parents: 7621
diff changeset
   393
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
   394
osSignalInterruptSignal
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   395
    "return the signal used for OS-signal error reporting;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   396
     This is only raised if handled - otherwise, a debugger is entered."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   397
8330
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
   398
    ^ OSSignalInterrupt
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   399
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   400
    "Modified: / 12.6.1998 / 16:27:26 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   401
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   402
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   403
primitiveFailureSignal
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   404
    "return the signal used for primitiveFailed - error handling"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   405
8330
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
   406
    ^ PrimitiveFailure
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   407
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   408
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   409
privateMethodSignal
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   410
    "return the signal used for privateMethod - error handling"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   411
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   412
    ^ MessageNotUnderstoodSignal
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   413
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   414
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
   415
recursionInterruptSignal
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   416
    "return the signal used for recursion overflow error handling"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   417
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   418
    ^ RecursionInterruptSignal
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   419
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   420
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   421
recursiveStoreStringSignal
8330
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
   422
    "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
   423
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
   424
    ^ RecursiveStoreError
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
   425
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
   426
    "
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
   427
     RecursiveStoreError handle:[:ex |
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   428
        self halt
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   429
     ] do:[
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   430
        |a|
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   431
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   432
        a := Array new:1.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   433
        a at:1 put:a.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   434
        a storeOn:Transcript
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   435
     ]
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   436
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   437
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   438
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   439
     |a|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   440
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   441
     a := Array new:1.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   442
     a at:1 put:a.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   443
     a storeOn:Transcript
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
5980
5fd29de6d596 more class based exceptions
Claus Gittinger <cg@exept.de>
parents: 5977
diff changeset
   447
subclassResponsibilitySignal
5fd29de6d596 more class based exceptions
Claus Gittinger <cg@exept.de>
parents: 5977
diff changeset
   448
    "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
   449
     (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
   450
5fd29de6d596 more class based exceptions
Claus Gittinger <cg@exept.de>
parents: 5977
diff changeset
   451
    ^ SubclassResponsibilityError
5fd29de6d596 more class based exceptions
Claus Gittinger <cg@exept.de>
parents: 5977
diff changeset
   452
!
5fd29de6d596 more class based exceptions
Claus Gittinger <cg@exept.de>
parents: 5977
diff changeset
   453
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   454
subscriptOutOfBoundsSignal
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   455
    "return the signal used for subscript error reporting.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   456
     (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
   457
      index less than 1 or greater than the array size)"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   458
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   459
    ^ SubscriptOutOfBoundsSignal
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   460
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   461
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   462
userInterruptSignal
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   463
    "return the signal used for ^C interrupts handling"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   464
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   465
    ^ UserInterruptSignal
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   466
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   467
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   468
userNotificationSignal
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   469
    "the parent signal used with information and warnings.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   470
     Handling this allows handling of both information- and warning notifications."
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
    ^ UserNotificationSignal
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
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
   475
warningSignal
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   476
    "return the signal used for warnings.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   477
     A handler for this signal gets all #warn: sends"
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
    ^ WarningSignal
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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   482
!Object class methodsFor:'info messages'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   483
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   484
infoPrinting
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   485
    "return the flag which controls information messages."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   486
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   487
    ^ InfoPrinting
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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   490
infoPrinting:aBoolean
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   491
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   492
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   493
    "turn on/off printing of information messages.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   494
     If the argument, aBoolean is false, infoPrint will not output
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   495
     messages. The default is true."
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
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   499
20027
5be764ee44fb #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 19846
diff changeset
   500
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   501
!Object class methodsFor:'queries'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   502
8892
5d05a7f150a5 +isAbstract
Claus Gittinger <cg@exept.de>
parents: 8879
diff changeset
   503
isAbstract
11221
1e88faaa1249 comment
Claus Gittinger <cg@exept.de>
parents: 11161
diff changeset
   504
    "Return if this class is an abstract class.
1e88faaa1249 comment
Claus Gittinger <cg@exept.de>
parents: 11161
diff changeset
   505
     True is returned for Object here; false for subclasses.
19451
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
   506
     Abstract subclasses must redefine this again."
11221
1e88faaa1249 comment
Claus Gittinger <cg@exept.de>
parents: 11161
diff changeset
   507
8892
5d05a7f150a5 +isAbstract
Claus Gittinger <cg@exept.de>
parents: 8879
diff changeset
   508
    ^ self == Object
5d05a7f150a5 +isAbstract
Claus Gittinger <cg@exept.de>
parents: 8879
diff changeset
   509
!
5d05a7f150a5 +isAbstract
Claus Gittinger <cg@exept.de>
parents: 8879
diff changeset
   510
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   511
isBuiltInClass
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   512
    "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
   513
     i.e. you cannot add/remove instance variables without recompiling
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   514
     the VM.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   515
     Here, true is returned for myself, false for subclasses."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   516
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   517
    ^ self == Object
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   518
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   519
    "Modified: 23.4.1996 / 16:00:07 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   520
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   521
14296
fe82bc5091f9 added: #isUUID
Stefan Vogel <sv@exept.de>
parents: 14292
diff changeset
   522
20027
5be764ee44fb #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 19846
diff changeset
   523
5be764ee44fb #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 19846
diff changeset
   524
8441
728c887f2532 Dolphin compatibility: #trigger...
Stefan Vogel <sv@exept.de>
parents: 8426
diff changeset
   525
!Object methodsFor:'Compatibility-Dolphin'!
728c887f2532 Dolphin compatibility: #trigger...
Stefan Vogel <sv@exept.de>
parents: 8426
diff changeset
   526
11161
3888d6f4e6f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11142
diff changeset
   527
stbFixup: anSTBInFiler at: newObjectIndex
3888d6f4e6f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11142
diff changeset
   528
    "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
   529
     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
   530
     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
   531
3888d6f4e6f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11142
diff changeset
   532
    ^ self
8441
728c887f2532 Dolphin compatibility: #trigger...
Stefan Vogel <sv@exept.de>
parents: 8426
diff changeset
   533
! !
728c887f2532 Dolphin compatibility: #trigger...
Stefan Vogel <sv@exept.de>
parents: 8426
diff changeset
   534
14682
6451898ed2a2 class: Object
Claus Gittinger <cg@exept.de>
parents: 14676
diff changeset
   535
!Object methodsFor:'Compatibility-GNU'!
6451898ed2a2 class: Object
Claus Gittinger <cg@exept.de>
parents: 14676
diff changeset
   536
6451898ed2a2 class: Object
Claus Gittinger <cg@exept.de>
parents: 14676
diff changeset
   537
display
6451898ed2a2 class: Object
Claus Gittinger <cg@exept.de>
parents: 14676
diff changeset
   538
    "print the receiver on the standard output stream (which is not the Transcript).
6451898ed2a2 class: Object
Claus Gittinger <cg@exept.de>
parents: 14676
diff changeset
   539
     Added for GNU-ST compatibility"
6451898ed2a2 class: Object
Claus Gittinger <cg@exept.de>
parents: 14676
diff changeset
   540
6451898ed2a2 class: Object
Claus Gittinger <cg@exept.de>
parents: 14676
diff changeset
   541
    self print
6451898ed2a2 class: Object
Claus Gittinger <cg@exept.de>
parents: 14676
diff changeset
   542
!
6451898ed2a2 class: Object
Claus Gittinger <cg@exept.de>
parents: 14676
diff changeset
   543
6451898ed2a2 class: Object
Claus Gittinger <cg@exept.de>
parents: 14676
diff changeset
   544
displayNl
6451898ed2a2 class: Object
Claus Gittinger <cg@exept.de>
parents: 14676
diff changeset
   545
    "print the receiver followed by a cr on the standard output stream (which is not the Transcript).
6451898ed2a2 class: Object
Claus Gittinger <cg@exept.de>
parents: 14676
diff changeset
   546
     Added for GNU-ST compatibility"
6451898ed2a2 class: Object
Claus Gittinger <cg@exept.de>
parents: 14676
diff changeset
   547
6451898ed2a2 class: Object
Claus Gittinger <cg@exept.de>
parents: 14676
diff changeset
   548
    self printCR
6451898ed2a2 class: Object
Claus Gittinger <cg@exept.de>
parents: 14676
diff changeset
   549
! !
6451898ed2a2 class: Object
Claus Gittinger <cg@exept.de>
parents: 14676
diff changeset
   550
7261
f35fc9cee675 method category rename
Claus Gittinger <cg@exept.de>
parents: 7216
diff changeset
   551
!Object methodsFor:'Compatibility-ST80'!
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   552
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   553
isMetaclass
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   554
    ^ self isMeta
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   555
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   556
7261
f35fc9cee675 method category rename
Claus Gittinger <cg@exept.de>
parents: 7216
diff changeset
   557
!Object methodsFor:'Compatibility-Squeak'!
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   558
9071
e7d44f6f017a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9005
diff changeset
   559
becomeForward:anotherObject
e7d44f6f017a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9005
diff changeset
   560
    self becomeSameAs:anotherObject
e7d44f6f017a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9005
diff changeset
   561
!
e7d44f6f017a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9005
diff changeset
   562
e7d44f6f017a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9005
diff changeset
   563
becomeForward:anotherObject copyHash:copyHash
e7d44f6f017a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9005
diff changeset
   564
    copyHash ifTrue:[ self error:'unsupported operation' ].
e7d44f6f017a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9005
diff changeset
   565
    self becomeSameAs:anotherObject
e7d44f6f017a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9005
diff changeset
   566
!
e7d44f6f017a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9005
diff changeset
   567
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   568
clone
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   569
    ^ self shallowCopy
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   570
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   571
6146
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   572
copyTwoLevel
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   573
    "one more level than a shallowCopy"
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   574
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   575
    ^ self copyToLevel:2
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   576
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   577
    "
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   578
     |original copy elL1 elL2 elL3 copyOfElL1|
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   579
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   580
     original := Array new:3.
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   581
     original at:1 put:1234.
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   582
     original at:2 put:'hello'.
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   583
     original at:3 put:(elL1 := Array new:3).
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   584
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   585
     elL1 at:1 put:1234.
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   586
     elL1 at:2 put:'hello'.
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   587
     elL1 at:3 put:(elL2 := Array new:3).
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   588
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   589
     elL2 at:1 put:1234.
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   590
     elL2 at:2 put:'hello'.
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   591
     elL2 at:3 put:(elL3 := Array new:3).
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   592
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   593
     elL3 at:1 put:1234.
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   594
     elL3 at:2 put:'hello'.
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   595
     elL3 at:3 put:(Array new:3).
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   596
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   597
     copy := original copyTwoLevel.
14534
5c9bbb0cc2ba class: Object
Stefan Vogel <sv@exept.de>
parents: 14532
diff changeset
   598
     self assert:((original at:2) ~~ (copy at:2)).
5c9bbb0cc2ba class: Object
Stefan Vogel <sv@exept.de>
parents: 14532
diff changeset
   599
     self assert:((original at:3) ~~ (copy at:3)).
6146
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   600
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   601
     copyOfElL1 := copy at:3.
14534
5c9bbb0cc2ba class: Object
Stefan Vogel <sv@exept.de>
parents: 14532
diff changeset
   602
     self assert:((elL1 at:2) == (copyOfElL1 at:2)).
5c9bbb0cc2ba class: Object
Stefan Vogel <sv@exept.de>
parents: 14532
diff changeset
   603
     self assert:((elL1 at:3) == (copyOfElL1 at:3)).
6146
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   604
    "
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   605
!
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   606
7320
0d5b4de4045a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7303
diff changeset
   607
explore
0d5b4de4045a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7303
diff changeset
   608
    (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
   609
    ifTrue:[
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   610
        self inspect
7320
0d5b4de4045a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7303
diff changeset
   611
    ]
0d5b4de4045a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7303
diff changeset
   612
!
0d5b4de4045a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7303
diff changeset
   613
12285
54773840f621 added: #inform: - squeak compatibility
Claus Gittinger <cg@exept.de>
parents: 12158
diff changeset
   614
inform: aString
54773840f621 added: #inform: - squeak compatibility
Claus Gittinger <cg@exept.de>
parents: 12158
diff changeset
   615
    "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
   616
54773840f621 added: #inform: - squeak compatibility
Claus Gittinger <cg@exept.de>
parents: 12158
diff changeset
   617
    self information:aString
54773840f621 added: #inform: - squeak compatibility
Claus Gittinger <cg@exept.de>
parents: 12158
diff changeset
   618
!
54773840f621 added: #inform: - squeak compatibility
Claus Gittinger <cg@exept.de>
parents: 12158
diff changeset
   619
16021
301a3939838f class: Object
Claus Gittinger <cg@exept.de>
parents: 16012
diff changeset
   620
isCompiledMethod
301a3939838f class: Object
Claus Gittinger <cg@exept.de>
parents: 16012
diff changeset
   621
    "same as isMethod - for squeak compatibility"
301a3939838f class: Object
Claus Gittinger <cg@exept.de>
parents: 16012
diff changeset
   622
301a3939838f class: Object
Claus Gittinger <cg@exept.de>
parents: 16012
diff changeset
   623
    ^ false
301a3939838f class: Object
Claus Gittinger <cg@exept.de>
parents: 16012
diff changeset
   624
!
301a3939838f class: Object
Claus Gittinger <cg@exept.de>
parents: 16012
diff changeset
   625
9335
2dcbf8f91693 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9314
diff changeset
   626
isInMemory
2dcbf8f91693 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9314
diff changeset
   627
    "All normal objects are."
2dcbf8f91693 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9314
diff changeset
   628
2dcbf8f91693 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9314
diff changeset
   629
    ^ true
2dcbf8f91693 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9314
diff changeset
   630
!
2dcbf8f91693 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9314
diff changeset
   631
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   632
stringForReadout
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   633
        ^ self stringRepresentation
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   634
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   635
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   636
stringRepresentation
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   637
        "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"
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   638
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   639
        ^ self printString
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   640
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   641
9146
56176a7bf685 +valueWithPossibleArguments:
Claus Gittinger <cg@exept.de>
parents: 9105
diff changeset
   642
valueWithPossibleArguments:argArray
56176a7bf685 +valueWithPossibleArguments:
Claus Gittinger <cg@exept.de>
parents: 9105
diff changeset
   643
     ^ self
56176a7bf685 +valueWithPossibleArguments:
Claus Gittinger <cg@exept.de>
parents: 9105
diff changeset
   644
!
56176a7bf685 +valueWithPossibleArguments:
Claus Gittinger <cg@exept.de>
parents: 9105
diff changeset
   645
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   646
veryDeepCopy
8383
dea5311899c5 comments in copy methods
Claus Gittinger <cg@exept.de>
parents: 8377
diff changeset
   647
     ^ self deepCopyUsing:(IdentityDictionary new)
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   648
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   649
7567
1c1a49b3ebf0 compatibility
Claus Gittinger <cg@exept.de>
parents: 7566
diff changeset
   650
!Object methodsFor:'Compatibility-VW'!
1c1a49b3ebf0 compatibility
Claus Gittinger <cg@exept.de>
parents: 7566
diff changeset
   651
8637
e7e695f53819 *** empty log message ***
penk
parents: 8632
diff changeset
   652
isCharacters
e7e695f53819 *** empty log message ***
penk
parents: 8632
diff changeset
   653
    "added for visual works compatibility"
e7e695f53819 *** empty log message ***
penk
parents: 8632
diff changeset
   654
    ^ false
e7e695f53819 *** empty log message ***
penk
parents: 8632
diff changeset
   655
!
e7e695f53819 *** empty log message ***
penk
parents: 8632
diff changeset
   656
18151
abf5900dc119 class: Object
Claus Gittinger <cg@exept.de>
parents: 18149
diff changeset
   657
isSignalledException
abf5900dc119 class: Object
Claus Gittinger <cg@exept.de>
parents: 18149
diff changeset
   658
    "VW compatibility"
abf5900dc119 class: Object
Claus Gittinger <cg@exept.de>
parents: 18149
diff changeset
   659
abf5900dc119 class: Object
Claus Gittinger <cg@exept.de>
parents: 18149
diff changeset
   660
    ^ self isException
abf5900dc119 class: Object
Claus Gittinger <cg@exept.de>
parents: 18149
diff changeset
   661
!
abf5900dc119 class: Object
Claus Gittinger <cg@exept.de>
parents: 18149
diff changeset
   662
7567
1c1a49b3ebf0 compatibility
Claus Gittinger <cg@exept.de>
parents: 7566
diff changeset
   663
keyNotFoundError:aKey
1c1a49b3ebf0 compatibility
Claus Gittinger <cg@exept.de>
parents: 7566
diff changeset
   664
    "VW compatibility"
1c1a49b3ebf0 compatibility
Claus Gittinger <cg@exept.de>
parents: 7566
diff changeset
   665
1c1a49b3ebf0 compatibility
Claus Gittinger <cg@exept.de>
parents: 7566
diff changeset
   666
    self errorKeyNotFound:aKey.
1c1a49b3ebf0 compatibility
Claus Gittinger <cg@exept.de>
parents: 7566
diff changeset
   667
!
1c1a49b3ebf0 compatibility
Claus Gittinger <cg@exept.de>
parents: 7566
diff changeset
   668
1c1a49b3ebf0 compatibility
Claus Gittinger <cg@exept.de>
parents: 7566
diff changeset
   669
oneWayBecome:anotherObject
1c1a49b3ebf0 compatibility
Claus Gittinger <cg@exept.de>
parents: 7566
diff changeset
   670
    ^ self becomeSameAs:anotherObject
1c1a49b3ebf0 compatibility
Claus Gittinger <cg@exept.de>
parents: 7566
diff changeset
   671
1c1a49b3ebf0 compatibility
Claus Gittinger <cg@exept.de>
parents: 7566
diff changeset
   672
    "
1c1a49b3ebf0 compatibility
Claus Gittinger <cg@exept.de>
parents: 7566
diff changeset
   673
     |arr o1 o2|
1c1a49b3ebf0 compatibility
Claus Gittinger <cg@exept.de>
parents: 7566
diff changeset
   674
1c1a49b3ebf0 compatibility
Claus Gittinger <cg@exept.de>
parents: 7566
diff changeset
   675
     arr := Array new:2.
1c1a49b3ebf0 compatibility
Claus Gittinger <cg@exept.de>
parents: 7566
diff changeset
   676
     arr at:1 put:(o1 := Object new).
1c1a49b3ebf0 compatibility
Claus Gittinger <cg@exept.de>
parents: 7566
diff changeset
   677
     arr at:2 put:(o2 := Point new).
1c1a49b3ebf0 compatibility
Claus Gittinger <cg@exept.de>
parents: 7566
diff changeset
   678
     o1 oneWayBecome:o2.
1c1a49b3ebf0 compatibility
Claus Gittinger <cg@exept.de>
parents: 7566
diff changeset
   679
     (arr at:1) ~~ o2 ifTrue:[self halt].
1c1a49b3ebf0 compatibility
Claus Gittinger <cg@exept.de>
parents: 7566
diff changeset
   680
    "
1c1a49b3ebf0 compatibility
Claus Gittinger <cg@exept.de>
parents: 7566
diff changeset
   681
    "
1c1a49b3ebf0 compatibility
Claus Gittinger <cg@exept.de>
parents: 7566
diff changeset
   682
     |arr o1 o2|
1c1a49b3ebf0 compatibility
Claus Gittinger <cg@exept.de>
parents: 7566
diff changeset
   683
1c1a49b3ebf0 compatibility
Claus Gittinger <cg@exept.de>
parents: 7566
diff changeset
   684
     arr := Array new:2.
1c1a49b3ebf0 compatibility
Claus Gittinger <cg@exept.de>
parents: 7566
diff changeset
   685
     arr at:1 put:(o1 := Object new).
1c1a49b3ebf0 compatibility
Claus Gittinger <cg@exept.de>
parents: 7566
diff changeset
   686
     arr at:2 put:(o2 := Point new).
1c1a49b3ebf0 compatibility
Claus Gittinger <cg@exept.de>
parents: 7566
diff changeset
   687
     o1 becomeSameAs:o2.
1c1a49b3ebf0 compatibility
Claus Gittinger <cg@exept.de>
parents: 7566
diff changeset
   688
     (arr at:1) ~~ o2 ifTrue:[self halt].
1c1a49b3ebf0 compatibility
Claus Gittinger <cg@exept.de>
parents: 7566
diff changeset
   689
    "
1c1a49b3ebf0 compatibility
Claus Gittinger <cg@exept.de>
parents: 7566
diff changeset
   690
! !
1c1a49b3ebf0 compatibility
Claus Gittinger <cg@exept.de>
parents: 7566
diff changeset
   691
20027
5be764ee44fb #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 19846
diff changeset
   692
5be764ee44fb #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 19846
diff changeset
   693
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   694
!Object methodsFor:'accessing'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   695
13320
Claus Gittinger <cg@exept.de>
parents: 13261
diff changeset
   696
_at:index
Claus Gittinger <cg@exept.de>
parents: 13261
diff changeset
   697
    "experimental:
Claus Gittinger <cg@exept.de>
parents: 13261
diff changeset
   698
     this is a synthetic selector, generated by the compiler,
Claus Gittinger <cg@exept.de>
parents: 13261
diff changeset
   699
     if a construct of the form expr[idx...] is parsed.
Claus Gittinger <cg@exept.de>
parents: 13261
diff changeset
   700
     I.e.
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   701
        v[n]
13320
Claus Gittinger <cg@exept.de>
parents: 13261
diff changeset
   702
     generates
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   703
        v _at: n
13320
Claus Gittinger <cg@exept.de>
parents: 13261
diff changeset
   704
    "
Claus Gittinger <cg@exept.de>
parents: 13261
diff changeset
   705
Claus Gittinger <cg@exept.de>
parents: 13261
diff changeset
   706
    ^ self at:index
Claus Gittinger <cg@exept.de>
parents: 13261
diff changeset
   707
Claus Gittinger <cg@exept.de>
parents: 13261
diff changeset
   708
    "Created: / 21-03-2011 / 14:07:57 / cg"
Claus Gittinger <cg@exept.de>
parents: 13261
diff changeset
   709
!
Claus Gittinger <cg@exept.de>
parents: 13261
diff changeset
   710
Claus Gittinger <cg@exept.de>
parents: 13261
diff changeset
   711
_at:index put:value
Claus Gittinger <cg@exept.de>
parents: 13261
diff changeset
   712
    "experimental:
Claus Gittinger <cg@exept.de>
parents: 13261
diff changeset
   713
     this is a synthetic selector, generated by the compiler,
Claus Gittinger <cg@exept.de>
parents: 13261
diff changeset
   714
     if a construct of the form expr[idx...] is parsed.
Claus Gittinger <cg@exept.de>
parents: 13261
diff changeset
   715
     I.e.
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   716
        v[n]
13320
Claus Gittinger <cg@exept.de>
parents: 13261
diff changeset
   717
     generates
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   718
        v _at: n
13320
Claus Gittinger <cg@exept.de>
parents: 13261
diff changeset
   719
    "
Claus Gittinger <cg@exept.de>
parents: 13261
diff changeset
   720
Claus Gittinger <cg@exept.de>
parents: 13261
diff changeset
   721
    ^ self at:index put:value
Claus Gittinger <cg@exept.de>
parents: 13261
diff changeset
   722
Claus Gittinger <cg@exept.de>
parents: 13261
diff changeset
   723
    "Created: / 21-03-2011 / 14:10:12 / cg"
Claus Gittinger <cg@exept.de>
parents: 13261
diff changeset
   724
!
Claus Gittinger <cg@exept.de>
parents: 13261
diff changeset
   725
14705
35456d16bcea class: Object
Claus Gittinger <cg@exept.de>
parents: 14682
diff changeset
   726
addSlot: slotName
35456d16bcea class: Object
Claus Gittinger <cg@exept.de>
parents: 14682
diff changeset
   727
    "dynamically add a new slot to the receiver.
35456d16bcea class: Object
Claus Gittinger <cg@exept.de>
parents: 14682
diff changeset
   728
     The receiver must be a real object, not nil or a smallInteger"
35456d16bcea class: Object
Claus Gittinger <cg@exept.de>
parents: 14682
diff changeset
   729
35456d16bcea class: Object
Claus Gittinger <cg@exept.de>
parents: 14682
diff changeset
   730
    |classGetter myClass anonCls newObj|
35456d16bcea class: Object
Claus Gittinger <cg@exept.de>
parents: 14682
diff changeset
   731
35456d16bcea class: Object
Claus Gittinger <cg@exept.de>
parents: 14682
diff changeset
   732
    myClass := self class.
35456d16bcea class: Object
Claus Gittinger <cg@exept.de>
parents: 14682
diff changeset
   733
    classGetter := ('%__get_',slotName,'__') asSymbol.
35456d16bcea class: Object
Claus Gittinger <cg@exept.de>
parents: 14682
diff changeset
   734
35456d16bcea class: Object
Claus Gittinger <cg@exept.de>
parents: 14682
diff changeset
   735
    anonCls := self perform:classGetter ifNotUnderstood:nil.
35456d16bcea class: Object
Claus Gittinger <cg@exept.de>
parents: 14682
diff changeset
   736
    anonCls isNil ifTrue:[
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   737
        anonCls := myClass
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   738
                subclass:(myClass name,'+',slotName) asSymbol
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   739
                instanceVariableNames:slotName
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   740
                classVariableNames:''
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   741
                poolDictionaries:'' category:nil
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   742
                inEnvironment:nil.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   743
        anonCls compile:('%1 ^  %1' bindWith:slotName).
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   744
        anonCls compile:('%1:v %1 := v' bindWith:slotName).
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   745
        Class withoutUpdatingChangesDo:[
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   746
            |m|
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   747
            m := Compiler compile:('__get_',slotName,' ^ #fooBar' bindWith:slotName) forClass:myClass install:false.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   748
            m literalAt:(m literals indexOf:#fooBar) put:anonCls.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   749
            myClass addSelector:classGetter withMethod:m.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   750
        ].
14705
35456d16bcea class: Object
Claus Gittinger <cg@exept.de>
parents: 14682
diff changeset
   751
    ].
35456d16bcea class: Object
Claus Gittinger <cg@exept.de>
parents: 14682
diff changeset
   752
    newObj := anonCls cloneFrom:self.
35456d16bcea class: Object
Claus Gittinger <cg@exept.de>
parents: 14682
diff changeset
   753
    self become:newObj.
35456d16bcea class: Object
Claus Gittinger <cg@exept.de>
parents: 14682
diff changeset
   754
35456d16bcea class: Object
Claus Gittinger <cg@exept.de>
parents: 14682
diff changeset
   755
    "
35456d16bcea class: Object
Claus Gittinger <cg@exept.de>
parents: 14682
diff changeset
   756
     |p1 p2 p3|
35456d16bcea class: Object
Claus Gittinger <cg@exept.de>
parents: 14682
diff changeset
   757
35456d16bcea class: Object
Claus Gittinger <cg@exept.de>
parents: 14682
diff changeset
   758
     p1 := Point x:10 y:20.
35456d16bcea class: Object
Claus Gittinger <cg@exept.de>
parents: 14682
diff changeset
   759
     p2 := Point x:100 y:200.
35456d16bcea class: Object
Claus Gittinger <cg@exept.de>
parents: 14682
diff changeset
   760
     Transcript show:'p1 is '; showCR:p1.
35456d16bcea class: Object
Claus Gittinger <cg@exept.de>
parents: 14682
diff changeset
   761
     Transcript show:'p2 is '; showCR:p2.
35456d16bcea class: Object
Claus Gittinger <cg@exept.de>
parents: 14682
diff changeset
   762
     p1 addSlot:'z'.
35456d16bcea class: Object
Claus Gittinger <cg@exept.de>
parents: 14682
diff changeset
   763
     p1 z:30.
35456d16bcea class: Object
Claus Gittinger <cg@exept.de>
parents: 14682
diff changeset
   764
     Transcript show:'p1 is '; showCR:p1.
35456d16bcea class: Object
Claus Gittinger <cg@exept.de>
parents: 14682
diff changeset
   765
     Transcript show:'p2 is '; showCR:p2.
35456d16bcea class: Object
Claus Gittinger <cg@exept.de>
parents: 14682
diff changeset
   766
     ObjectMemory dumpObject:p1.
35456d16bcea class: Object
Claus Gittinger <cg@exept.de>
parents: 14682
diff changeset
   767
     ObjectMemory dumpObject:p2.
35456d16bcea class: Object
Claus Gittinger <cg@exept.de>
parents: 14682
diff changeset
   768
35456d16bcea class: Object
Claus Gittinger <cg@exept.de>
parents: 14682
diff changeset
   769
     p1 addSlot:'t'.
35456d16bcea class: Object
Claus Gittinger <cg@exept.de>
parents: 14682
diff changeset
   770
     p1 t:30.
35456d16bcea class: Object
Claus Gittinger <cg@exept.de>
parents: 14682
diff changeset
   771
     Transcript show:'p1 is '; showCR:p1.
35456d16bcea class: Object
Claus Gittinger <cg@exept.de>
parents: 14682
diff changeset
   772
     ObjectMemory dumpObject:p1.
35456d16bcea class: Object
Claus Gittinger <cg@exept.de>
parents: 14682
diff changeset
   773
35456d16bcea class: Object
Claus Gittinger <cg@exept.de>
parents: 14682
diff changeset
   774
     p3 := Point x:110 y:120.
35456d16bcea class: Object
Claus Gittinger <cg@exept.de>
parents: 14682
diff changeset
   775
     p3 addSlot:'z'.
35456d16bcea class: Object
Claus Gittinger <cg@exept.de>
parents: 14682
diff changeset
   776
     p3 addSlot:'t'.
35456d16bcea class: Object
Claus Gittinger <cg@exept.de>
parents: 14682
diff changeset
   777
     p1 inspect.
35456d16bcea class: Object
Claus Gittinger <cg@exept.de>
parents: 14682
diff changeset
   778
     p2 inspect.
35456d16bcea class: Object
Claus Gittinger <cg@exept.de>
parents: 14682
diff changeset
   779
     p3 inspect.
35456d16bcea class: Object
Claus Gittinger <cg@exept.de>
parents: 14682
diff changeset
   780
    "
35456d16bcea class: Object
Claus Gittinger <cg@exept.de>
parents: 14682
diff changeset
   781
!
35456d16bcea class: Object
Claus Gittinger <cg@exept.de>
parents: 14682
diff changeset
   782
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   783
at:index
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   784
    "return the indexed instance variable with index, anInteger;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   785
     this method can be redefined in subclasses."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   786
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   787
    ^ self basicAt:index
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   788
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   789
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   790
at:index put:anObject
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   791
    "store the 2nd arg, anObject as indexed instvar with index, anInteger.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   792
     this method can be redefined in subclasses. Returns anObject (sigh)"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   793
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   794
    ^ self basicAt:index put:anObject
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   795
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   796
    "Modified: 19.4.1996 / 11:13:29 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   797
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   798
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   799
basicAt:index
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   800
    "return the indexed instance variable with index, anInteger.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   801
     Trigger an error if the receiver has no indexed instance variables.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   802
     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
   803
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   804
%{  /* NOCONTEXT */
18240
28af09029a8b ifdef for SCHTEAM engine changed (not relevant for ST/X)
Claus Gittinger <cg@exept.de>
parents: 18238
diff changeset
   805
#ifdef __SCHTEAM__
18215
5940d5eff81b java preps
Claus Gittinger <cg@exept.de>
parents: 18185
diff changeset
   806
    {
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   807
        int idx1Based = index.intValue();   // st index is 1 based
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   808
        return context._RETURN( self.basicAt( idx1Based ));
18215
5940d5eff81b java preps
Claus Gittinger <cg@exept.de>
parents: 18185
diff changeset
   809
    }
5940d5eff81b java preps
Claus Gittinger <cg@exept.de>
parents: 18185
diff changeset
   810
    /* NOTREACHED */
5940d5eff81b java preps
Claus Gittinger <cg@exept.de>
parents: 18185
diff changeset
   811
#else
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   812
    REGISTER int nbytes, indx;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   813
    OBJ myClass;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   814
    REGISTER char *pFirst;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   815
    REGISTER int n;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   816
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   817
    /*
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   818
     * notice the missing test for self being a nonNilObject -
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   819
     * this can be done since basicAt: is defined both in UndefinedObject
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   820
     * and SmallInteger
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   821
     */
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   822
    if (__isSmallInteger(index)) {
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   823
        myClass = __qClass(self);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   824
        indx = __intVal(index) - 1;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   825
        n /* nInstVars */ = __intVal(__ClassInstPtr(myClass)->c_ninstvars);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   826
        n /* nInstBytes */ = OHDR_SIZE + __OBJS2BYTES__(n /* nInstVars */);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   827
        nbytes = __qSize(self) - n /* nInstBytes */;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   828
        pFirst = (char *)(__InstPtr(self)) + n /* nInstBytes */;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   829
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   830
        switch ((INT)(__ClassInstPtr(myClass)->c_flags) & __MASKSMALLINT(ARRAYMASK)) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   831
            case __MASKSMALLINT(POINTERARRAY):
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   832
                /*
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   833
                 * pointers
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   834
                 */
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   835
                if ((unsigned)indx < (__BYTES2OBJS__(nbytes))) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   836
                    OBJ *op;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   837
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   838
                    op = (OBJ *)pFirst + indx;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   839
                    RETURN ( *op );
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   840
                }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   841
                break;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   842
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   843
            case __MASKSMALLINT(WKPOINTERARRAY):
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   844
                if ((unsigned)indx < (__BYTES2OBJS__(nbytes))) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   845
                    OBJ *op;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   846
                    OBJ el;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   847
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   848
                    op = (OBJ *)pFirst + indx;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   849
                    el = *op;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   850
                    el = __WEAK_READ__(self, el);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   851
                    RETURN ( el );
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   852
                }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   853
                break;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   854
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   855
            case __MASKSMALLINT(BYTEARRAY):
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   856
                /*
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   857
                 * (unsigned) bytes
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   858
                 */
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   859
                if ((unsigned)indx < nbytes) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   860
                    unsigned char *cp;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   861
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   862
                    cp = (unsigned char *)pFirst + indx;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   863
                    RETURN ( __mkSmallInteger( (*cp & 0xFF)) );
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   864
                }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   865
                break;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   866
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   867
            case __MASKSMALLINT(FLOATARRAY):
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   868
                /*
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   869
                 * native floats
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   870
                 */
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   871
                if ((unsigned)indx < (nbytes / sizeof(float))) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   872
                    float *fp;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   873
                    float f;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   874
                    OBJ v;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   875
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   876
                    fp = (float *)pFirst + indx;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   877
                    f = *fp;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   878
                    if (f == 0.0) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   879
                        v = STX__float0;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   880
                    } else {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   881
                        __qMKSFLOAT(v, f);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   882
                    }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   883
                    RETURN (v);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   884
                }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   885
                break;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   886
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   887
            case __MASKSMALLINT(DOUBLEARRAY):
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   888
                /*
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   889
                 * native doubles
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   890
                 */
18215
5940d5eff81b java preps
Claus Gittinger <cg@exept.de>
parents: 18185
diff changeset
   891
# ifdef __NEED_DOUBLE_ALIGN
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   892
                if ((INT)pFirst & (__DOUBLE_ALIGN-1)) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   893
                    int delta = __DOUBLE_ALIGN - ((INT)pFirst & (__DOUBLE_ALIGN-1));
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   894
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   895
                    pFirst += delta;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   896
                    nbytes -= delta;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   897
                }
18215
5940d5eff81b java preps
Claus Gittinger <cg@exept.de>
parents: 18185
diff changeset
   898
# endif
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   899
                if ((unsigned)indx < (nbytes / sizeof(double))) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   900
                    double *dp;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   901
                    double d;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   902
                    OBJ v;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   903
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   904
                    dp = (double *)pFirst + indx;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   905
                    d = *dp;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   906
                    if (d == 0.0) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   907
                        v = STX__float0;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   908
                    } else {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   909
                        __qMKFLOAT(v, d);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   910
                    }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   911
                    RETURN (v);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   912
                }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   913
                break;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   914
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   915
            case __MASKSMALLINT(WORDARRAY):
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   916
                /*
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   917
                 * unsigned 16bit ints
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   918
                 */
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   919
                /* Notice: the hard coded shifts are by purpose;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   920
                 * it makes us independent of the short-size of the machine
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   921
                 */
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   922
                if ((unsigned)indx < (nbytes>>1)) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   923
                    unsigned short *sp;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   924
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   925
                    sp = (unsigned short *)(pFirst + (indx<<1));
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   926
                    RETURN ( __mkSmallInteger( (*sp & 0xFFFF)) );
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   927
                }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   928
                break;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   929
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   930
            case __MASKSMALLINT(SWORDARRAY):
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   931
                /*
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   932
                 * signed 16bit ints
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   933
                 */
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   934
                /* Notice: the hard coded shifts are by purpose;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   935
                 * it makes us independent of the short-size of the machine
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   936
                 */
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   937
                if ((unsigned)indx < (nbytes>>1)) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   938
                    short *ssp;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   939
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   940
                    ssp = (short *)(pFirst + (indx<<1));
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   941
                    RETURN ( __mkSmallInteger( (*ssp) ));
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   942
                }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   943
                break;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   944
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   945
            case __MASKSMALLINT(LONGARRAY):
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   946
                /*
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   947
                 * unsigned 32bit ints
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   948
                 */
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   949
                /* Notice: the hard coded shifts are by purpose;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   950
                 * it makes us independent of the int-size of the machine
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   951
                 */
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   952
                if ((unsigned)indx < (nbytes>>2)) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   953
                    unsigned int32 ul;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   954
                    unsigned int32 *lp;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   955
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   956
                    lp = (unsigned int32 *)(pFirst + (indx<<2));
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   957
                    ul = *lp;
18215
5940d5eff81b java preps
Claus Gittinger <cg@exept.de>
parents: 18185
diff changeset
   958
# if __POINTER_SIZE__ == 8
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   959
                    {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   960
                        unsigned INT ull = (unsigned INT)ul;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   961
                        RETURN ( __mkSmallInteger(ull) );
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   962
                    }
18215
5940d5eff81b java preps
Claus Gittinger <cg@exept.de>
parents: 18185
diff changeset
   963
# else
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   964
                    if (ul <= _MAX_INT) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   965
                        RETURN ( __mkSmallInteger(ul) );
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   966
                    }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   967
                    RETURN ( __MKULARGEINT(ul) );
18215
5940d5eff81b java preps
Claus Gittinger <cg@exept.de>
parents: 18185
diff changeset
   968
# endif
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   969
                }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   970
                break;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   971
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   972
            case __MASKSMALLINT(SLONGARRAY):
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   973
                /*
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   974
                 * signed 32bit ints
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   975
                 */
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   976
                /* Notice: the hard coded shifts are by purpose;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   977
                 * it makes us independent of the int-size of the machine
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   978
                 */
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   979
                if ((unsigned)indx < (nbytes>>2)) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   980
                    int32 *slp;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   981
                    int32 l;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   982
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   983
                    slp = (int32 *)(pFirst + (indx<<2));
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   984
                    l = *slp;
18215
5940d5eff81b java preps
Claus Gittinger <cg@exept.de>
parents: 18185
diff changeset
   985
# if __POINTER_SIZE__ == 8
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   986
                    {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   987
                        INT ll = (INT)l;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   988
                        RETURN ( __mkSmallInteger(ll) );
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   989
                    }
18215
5940d5eff81b java preps
Claus Gittinger <cg@exept.de>
parents: 18185
diff changeset
   990
# else
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   991
                    if (__ISVALIDINTEGER(l)) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   992
                        RETURN ( __mkSmallInteger(l) );
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   993
                    }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   994
                    RETURN ( __MKLARGEINT(l) );
18215
5940d5eff81b java preps
Claus Gittinger <cg@exept.de>
parents: 18185
diff changeset
   995
# endif
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   996
                }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   997
                break;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   998
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
   999
            case __MASKSMALLINT(SLONGLONGARRAY):
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1000
                /*
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1001
                 * signed 64bit longlongs
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1002
                 */
18215
5940d5eff81b java preps
Claus Gittinger <cg@exept.de>
parents: 18185
diff changeset
  1003
# ifdef __NEED_LONGLONG_ALIGN
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1004
                if ((INT)pFirst & (__LONGLONG_ALIGN-1)) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1005
                    int delta = __LONGLONG_ALIGN - ((INT)pFirst & (__LONGLONG_ALIGN-1));
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1006
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1007
                    pFirst += delta;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1008
                    nbytes -= delta;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1009
                }
18215
5940d5eff81b java preps
Claus Gittinger <cg@exept.de>
parents: 18185
diff changeset
  1010
# endif
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1011
                /* Notice: the hard coded shifts are by purpose;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1012
                 * it makes us independent of the long/longlong-size of the machine
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1013
                 */
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1014
                if ((unsigned)indx < (nbytes>>3)) {
18215
5940d5eff81b java preps
Claus Gittinger <cg@exept.de>
parents: 18185
diff changeset
  1015
# if __POINTER_SIZE__ == 8
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1016
                    INT *slp, ll;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1017
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1018
                    slp = (INT *)(pFirst + (indx<<3));
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1019
                    ll = *slp;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1020
                    if (__ISVALIDINTEGER(ll)) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1021
                        RETURN ( __mkSmallInteger(ll) );
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1022
                    }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1023
                    RETURN ( __MKLARGEINT(ll) );
18215
5940d5eff81b java preps
Claus Gittinger <cg@exept.de>
parents: 18185
diff changeset
  1024
# else
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1025
                    __int64__ *llp;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1026
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1027
                    llp = (__int64__ *)(pFirst + (indx<<3));
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1028
                    RETURN (__MKINT64(llp));
18215
5940d5eff81b java preps
Claus Gittinger <cg@exept.de>
parents: 18185
diff changeset
  1029
# endif
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1030
                }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1031
                break;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1032
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1033
            case __MASKSMALLINT(LONGLONGARRAY):
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1034
                /*
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1035
                 * unsigned 64bit longlongs
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1036
                 */
18215
5940d5eff81b java preps
Claus Gittinger <cg@exept.de>
parents: 18185
diff changeset
  1037
# ifdef __NEED_LONGLONG_ALIGN
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1038
                if ((INT)pFirst & (__LONGLONG_ALIGN-1)) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1039
                    int delta = __LONGLONG_ALIGN - ((INT)pFirst & (__LONGLONG_ALIGN-1));
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1040
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1041
                    pFirst += delta;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1042
                    nbytes -= delta;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1043
                }
18215
5940d5eff81b java preps
Claus Gittinger <cg@exept.de>
parents: 18185
diff changeset
  1044
# endif
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1045
                /* Notice: the hard coded shifts are by purpose;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1046
                 * it makes us independent of the long/longlong-size of the machine
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1047
                 */
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1048
                if ((unsigned)indx < (nbytes>>3)) {
18215
5940d5eff81b java preps
Claus Gittinger <cg@exept.de>
parents: 18185
diff changeset
  1049
# if __POINTER_SIZE__ == 8
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1050
                    unsigned INT *ulp, ul;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1051
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1052
                    ulp = (unsigned INT *)(pFirst + (indx<<3));
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1053
                    ul = *ulp;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1054
                    if (ul <= _MAX_INT) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1055
                        RETURN ( __mkSmallInteger(ul) );
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1056
                    }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1057
                    RETURN ( __MKULARGEINT(ul) );
18215
5940d5eff81b java preps
Claus Gittinger <cg@exept.de>
parents: 18185
diff changeset
  1058
# else
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1059
                    __uint64__ *llp;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1060
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1061
                    llp = (__uint64__ *)(pFirst + (indx<<3));
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1062
                    RETURN (__MKUINT64(llp));
18215
5940d5eff81b java preps
Claus Gittinger <cg@exept.de>
parents: 18185
diff changeset
  1063
# endif
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1064
                }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1065
                break;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1066
        }
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1067
    }
18240
28af09029a8b ifdef for SCHTEAM engine changed (not relevant for ST/X)
Claus Gittinger <cg@exept.de>
parents: 18238
diff changeset
  1068
#endif /* ! __SCHTEAM__ */
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1069
%}.
7216
59bfa2ffdcf7 utility
Claus Gittinger <cg@exept.de>
parents: 7215
diff changeset
  1070
    ^ self indexNotIntegerOrOutOfBounds:index
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1071
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1072
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1073
basicAt:index put:anObject
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1074
    "store the 2nd arg, anObject as indexed instvar with index, anInteger.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1075
     Returns anObject (sigh).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1076
     Trigger an error if the receiver has no indexed instance variables.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1077
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1078
     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
  1079
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1080
%{  /* NOCONTEXT */
18240
28af09029a8b ifdef for SCHTEAM engine changed (not relevant for ST/X)
Claus Gittinger <cg@exept.de>
parents: 18238
diff changeset
  1081
#ifdef __SCHTEAM__
18215
5940d5eff81b java preps
Claus Gittinger <cg@exept.de>
parents: 18185
diff changeset
  1082
    {
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1083
        int idx1Based = index.intValue();   // st index is 1 based
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1084
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1085
        self.basicAt_put(idx1Based, anObject );
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1086
        return context._RETURN( anObject );
18215
5940d5eff81b java preps
Claus Gittinger <cg@exept.de>
parents: 18185
diff changeset
  1087
    }
5940d5eff81b java preps
Claus Gittinger <cg@exept.de>
parents: 18185
diff changeset
  1088
    /* NOTREACHED */
5940d5eff81b java preps
Claus Gittinger <cg@exept.de>
parents: 18185
diff changeset
  1089
#else
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1090
    register int nbytes, indx;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1091
    OBJ myClass;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1092
    register char *pFirst;
18215
5940d5eff81b java preps
Claus Gittinger <cg@exept.de>
parents: 18185
diff changeset
  1093
    /* int nInstBytes, ninstvars, flags; */
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1094
    REGISTER int n;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1095
    unsigned int u;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1096
    int val;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1097
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1098
    /* notice the missing test for self being a nonNilObject -
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1099
       this can be done since basicAt: is defined both in UndefinedObject
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1100
       and SmallInteger */
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1101
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1102
    if (__isSmallInteger(index)) {
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1103
        indx = __intVal(index) - 1;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1104
        myClass = __qClass(self);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1105
        n /* ninstvars */ = __intVal(__ClassInstPtr(myClass)->c_ninstvars);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1106
        n /* nInstBytes */ = OHDR_SIZE + __OBJS2BYTES__(n /* ninstvars */);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1107
        nbytes = __qSize(self) - n /* nInstBytes */;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1108
        pFirst = (char *)(__InstPtr(self)) + n /* nInstBytes */;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1109
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1110
        switch ((INT)(__ClassInstPtr(myClass)->c_flags) & __MASKSMALLINT(ARRAYMASK)) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1111
            case __MASKSMALLINT(POINTERARRAY):
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1112
                if ((unsigned)indx < (__BYTES2OBJS__(nbytes))) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1113
                    OBJ *op;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1114
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1115
                    op = (OBJ *)pFirst + indx;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1116
                    *op = anObject;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1117
                    __STORE(self, anObject);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1118
                    RETURN ( anObject );
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1119
                }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1120
                break;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1121
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1122
            case __MASKSMALLINT(WKPOINTERARRAY):
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1123
                if ((unsigned)indx < (__BYTES2OBJS__(nbytes))) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1124
                    OBJ *op;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1125
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1126
                    op = (OBJ *)pFirst + indx;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1127
                    *op = anObject;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1128
                    __STORE(self, anObject);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1129
                    __WEAK_WRITE__(self, anObject);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1130
                    RETURN ( anObject );
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1131
                }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1132
                break;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1133
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1134
            case __MASKSMALLINT(BYTEARRAY):
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1135
                if (__isSmallInteger(anObject)) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1136
                    val = __intVal(anObject);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1137
                    if ((val & ~0xFF) == 0 /* i.e. (val >= 0) && (val <= 255) */) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1138
                        if ((unsigned)indx < nbytes) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1139
                            char *cp;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1140
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1141
                            cp = pFirst + indx;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1142
                            *cp = val;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1143
                            RETURN ( anObject );
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1144
                        }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1145
                    }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1146
                }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1147
                break;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1148
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1149
            case __MASKSMALLINT(FLOATARRAY):
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1150
                if ((unsigned)indx < (nbytes / sizeof(float))) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1151
                    float *fp;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1152
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1153
                    fp = (float *)pFirst + indx;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1154
                    if (anObject != nil) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1155
                        if (! __isSmallInteger(anObject)) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1156
                            if (__qIsFloatLike(anObject)) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1157
                                *fp = (float)(__floatVal(anObject));
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1158
                                RETURN ( anObject );
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1159
                            }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1160
                            if (__qIsShortFloat(anObject)) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1161
                                *fp = __shortFloatVal(anObject);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1162
                                RETURN ( anObject );
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1163
                            }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1164
                        } else {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1165
                            *fp = (float) __intVal(anObject);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1166
                            RETURN ( anObject );
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1167
                        }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1168
                    }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1169
                }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1170
                break;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1171
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1172
            case __MASKSMALLINT(DOUBLEARRAY):
18215
5940d5eff81b java preps
Claus Gittinger <cg@exept.de>
parents: 18185
diff changeset
  1173
# ifdef __NEED_DOUBLE_ALIGN
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1174
                if ((INT)pFirst & (__DOUBLE_ALIGN-1)) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1175
                    int delta = __DOUBLE_ALIGN - ((INT)pFirst & (__DOUBLE_ALIGN-1));
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1176
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1177
                    pFirst += delta;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1178
                    nbytes -= delta;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1179
                }
18215
5940d5eff81b java preps
Claus Gittinger <cg@exept.de>
parents: 18185
diff changeset
  1180
# endif
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1181
                if ((unsigned)indx < (nbytes / sizeof(double))) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1182
                    double *dp;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1183
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1184
                    dp = (double *)pFirst + indx;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1185
                    if (anObject != nil) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1186
                        if (! __isSmallInteger(anObject)) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1187
                            if (__qIsFloatLike(anObject)) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1188
                                *dp = __floatVal(anObject);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1189
                                RETURN ( anObject );
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1190
                            }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1191
                            if (__qIsShortFloat(anObject)) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1192
                                *dp = (double)__shortFloatVal(anObject);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1193
                                RETURN ( anObject );
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1194
                            }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1195
                        } else {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1196
                            *dp = (double) __intVal(anObject);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1197
                            RETURN ( anObject );
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1198
                        }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1199
                    }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1200
                }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1201
                break;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1202
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1203
            case __MASKSMALLINT(WORDARRAY):
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1204
                if (__isSmallInteger(anObject)) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1205
                    val = __intVal(anObject);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1206
                    if ((unsigned)val <= 0xFFFF) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1207
                        if ((unsigned)indx < (nbytes>>1)) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1208
                            unsigned short *sp;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1209
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1210
                            sp = (unsigned short *)(pFirst + (indx<<1));
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1211
                            *sp = val;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1212
                            RETURN ( anObject );
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1213
                        }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1214
                    }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1215
                }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1216
                break;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1217
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1218
            case __MASKSMALLINT(SWORDARRAY):
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1219
                if (__isSmallInteger(anObject)) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1220
                    val = __intVal(anObject);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1221
                    if ((val >= -32768) && (val < 32768)) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1222
                        if ((unsigned)indx < (nbytes>>1)) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1223
                            short *ssp;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1224
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1225
                            ssp = (short *)(pFirst + (indx<<1));
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1226
                            *ssp = val;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1227
                            RETURN ( anObject );
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1228
                        }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1229
                    }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1230
                }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1231
                break;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1232
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1233
            case __MASKSMALLINT(SLONGARRAY):
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1234
                if ((unsigned)indx < (nbytes>>2)) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1235
                    int32 *slp;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1236
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1237
                    slp = (int32 *)(pFirst + (indx<<2));
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1238
                    if (__isSmallInteger(anObject)) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1239
                        *slp = __intVal(anObject);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1240
                        RETURN ( anObject );
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1241
                    }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1242
                    n = __signedLongIntVal(anObject);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1243
                    /*
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1244
                     * zero means failure for an int larger than INT-size bytes
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1245
                     * (would be a smallInteger)
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1246
                     */
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1247
                    if (n) {
18215
5940d5eff81b java preps
Claus Gittinger <cg@exept.de>
parents: 18185
diff changeset
  1248
# if __POINTER_SIZE__ == 8
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1249
                        if ((n >= -0x80000000) && (n < 0x80000000))
18215
5940d5eff81b java preps
Claus Gittinger <cg@exept.de>
parents: 18185
diff changeset
  1250
# endif
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1251
                        {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1252
                            *slp = n;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1253
                            RETURN ( anObject );
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1254
                        }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1255
                    }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1256
                }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1257
                break;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1258
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1259
            case __MASKSMALLINT(LONGARRAY):
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1260
                if ((unsigned)indx < (nbytes>>2)) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1261
                    unsigned int32 *lp;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1262
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1263
                    lp = (unsigned int32 *)(pFirst + (indx<<2));
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1264
                    if (anObject == __mkSmallInteger(0)) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1265
                        *lp = 0;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1266
                        RETURN ( anObject );
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1267
                    }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1268
                    u = __longIntVal(anObject);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1269
                    /*
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1270
                     * zero means failure for an int larger than 4 bytes
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1271
                     * (would be a smallInteger)
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1272
                     */
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1273
                    if (u) {
18215
5940d5eff81b java preps
Claus Gittinger <cg@exept.de>
parents: 18185
diff changeset
  1274
# if __POINTER_SIZE__ == 8
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1275
                        if (u <= 0xFFFFFFFF)
18215
5940d5eff81b java preps
Claus Gittinger <cg@exept.de>
parents: 18185
diff changeset
  1276
# endif
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1277
                        {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1278
                            *lp = u;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1279
                            RETURN ( anObject );
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1280
                        }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1281
                    }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1282
                }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1283
                break;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1284
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1285
            case __MASKSMALLINT(SLONGLONGARRAY):
18215
5940d5eff81b java preps
Claus Gittinger <cg@exept.de>
parents: 18185
diff changeset
  1286
# ifdef __NEED_LONGLONG_ALIGN
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1287
                if ((INT)pFirst & (__LONGLONG_ALIGN-1)) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1288
                    int delta = __LONGLONG_ALIGN - ((INT)pFirst & (__LONGLONG_ALIGN-1));
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1289
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1290
                    pFirst += delta;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1291
                    nbytes -= delta;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1292
                }
18215
5940d5eff81b java preps
Claus Gittinger <cg@exept.de>
parents: 18185
diff changeset
  1293
# endif
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1294
                if ((unsigned)indx < (nbytes>>3)) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1295
                    __int64__ ll;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1296
                    __int64__ *sllp;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1297
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1298
                    sllp = (__int64__ *)(pFirst + (indx<<3));
14632
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14539
diff changeset
  1299
18215
5940d5eff81b java preps
Claus Gittinger <cg@exept.de>
parents: 18185
diff changeset
  1300
# if __POINTER_SIZE__ == 8
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1301
                    if (__isSmallInteger(anObject)) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1302
                        *sllp = __intVal(anObject);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1303
                        RETURN ( anObject );
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1304
                    }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1305
                    n = __signedLongIntVal(anObject);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1306
                    if (n) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1307
                        *sllp = n;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1308
                        RETURN ( anObject );
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1309
                    }
18215
5940d5eff81b java preps
Claus Gittinger <cg@exept.de>
parents: 18185
diff changeset
  1310
# else
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1311
                    if (anObject == __mkSmallInteger(0)) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1312
                        ll.lo = ll.hi = 0;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1313
                        *sllp = ll;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1314
                        RETURN ( anObject );
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1315
                    }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1316
                    if (__signedLong64IntVal(anObject, &ll)) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1317
                        *sllp = ll;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1318
                        RETURN ( anObject );
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1319
                    }
18215
5940d5eff81b java preps
Claus Gittinger <cg@exept.de>
parents: 18185
diff changeset
  1320
# endif
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1321
                }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1322
                break;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1323
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1324
            case __MASKSMALLINT(LONGLONGARRAY):
18215
5940d5eff81b java preps
Claus Gittinger <cg@exept.de>
parents: 18185
diff changeset
  1325
# ifdef __NEED_LONGLONG_ALIGN
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1326
                if ((INT)pFirst & (__LONGLONG_ALIGN-1)) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1327
                    int delta = __LONGLONG_ALIGN - ((INT)pFirst & (__LONGLONG_ALIGN-1));
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1328
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1329
                    pFirst += delta;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1330
                    nbytes -= delta;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1331
                }
18215
5940d5eff81b java preps
Claus Gittinger <cg@exept.de>
parents: 18185
diff changeset
  1332
# endif
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1333
                if ((unsigned)indx < (nbytes>>3)) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1334
                    __uint64__ ll;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1335
                    __uint64__ *llp;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1336
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1337
                    llp = (__uint64__ *)(pFirst + (indx<<3));
18215
5940d5eff81b java preps
Claus Gittinger <cg@exept.de>
parents: 18185
diff changeset
  1338
# if __POINTER_SIZE__ == 8
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1339
                    if (__isSmallInteger(anObject)) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1340
                        *llp = __intVal(anObject);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1341
                        RETURN ( anObject );
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1342
                    }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1343
                    ll = __longIntVal(anObject);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1344
                    if (ll) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1345
                        *llp = ll;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1346
                        RETURN ( anObject );
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1347
                    }
18215
5940d5eff81b java preps
Claus Gittinger <cg@exept.de>
parents: 18185
diff changeset
  1348
# else
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1349
                    if (anObject == __mkSmallInteger(0)) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1350
                        ll.lo = ll.hi = 0;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1351
                        *llp = ll;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1352
                        RETURN ( anObject );
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1353
                    }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1354
                    if (__unsignedLong64IntVal(anObject, &ll)) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1355
                        *llp = ll;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1356
                        RETURN ( anObject );
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1357
                    }
18215
5940d5eff81b java preps
Claus Gittinger <cg@exept.de>
parents: 18185
diff changeset
  1358
# endif
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1359
                }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1360
                break;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1361
        }
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1362
    }
18240
28af09029a8b ifdef for SCHTEAM engine changed (not relevant for ST/X)
Claus Gittinger <cg@exept.de>
parents: 18238
diff changeset
  1363
#endif /* ! __SCHTEAM__ */
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1364
%}.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1365
    index isInteger ifFalse:[
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1366
        "
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1367
         the index should be an integer number
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1368
        "
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1369
        ^ self indexNotInteger:index
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1370
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1371
    (index between:1 and:self size) ifFalse:[
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1372
        "
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1373
         the index is less than 1 or greater than the size of the
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1374
         receiver collection
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1375
        "
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1376
        ^ self subscriptBoundsError:index
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1377
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1378
    (self class isFloatsOrDoubles) ifTrue:[
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1379
        anObject isNumber ifTrue:[
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1380
            ^ self basicAt:index put:(anObject asFloat)
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1381
        ]
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1382
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1383
    anObject isInteger ifFalse:[
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1384
        "
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1385
         the object to put into the receiver collection
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1386
         should be an integer number
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1387
        "
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1388
        ^ self elementNotInteger
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1389
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1390
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1391
     the object to put into the receiver collection
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1392
     is not an instance of the expected element class,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1393
     or the value is  not within the elements valid range.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1394
    "
7215
733294e1a8cc correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 7211
diff changeset
  1395
    ^ self elementBoundsError:anObject
5755
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
    "Modified: 19.4.1996 / 11:14:10 / cg"
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
byteAt:index
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  1401
    "return the byte at index.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1402
     This is only allowed for non-pointer indexed objects
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1403
     (i.e. byteArrays, wordArrays, floatArrays etc.).
19451
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  1404
     The receiver's indexed instvars are treated as an uninterpreted
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1405
     collection of bytes.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1406
     Only useful with binary storage."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1407
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1408
%{  /* NOCONTEXT */
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
    if (__isSmallInteger(index)) {
19841
b0023122a5aa #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 19802
diff changeset
  1411
        OBJ slf = self;
19451
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  1412
        if (__isNonNilObject(slf)) {
19841
b0023122a5aa #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 19802
diff changeset
  1413
            OBJ cls = __qClass(slf);
b0023122a5aa #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 19802
diff changeset
  1414
            INT indx = __intVal(index) - 1;
b0023122a5aa #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 19802
diff changeset
  1415
            INT nIndex = __byteArraySize(slf);
b0023122a5aa #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 19802
diff changeset
  1416
            unsigned char *pFirst = __byteArrayVal(slf) + __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars));
19451
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  1417
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  1418
            switch ((INT)(__ClassInstPtr(cls)->c_flags) & __MASKSMALLINT(ARRAYMASK)) {
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  1419
                case __MASKSMALLINT(DOUBLEARRAY):
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1420
#ifdef __NEED_DOUBLE_ALIGN
19451
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  1421
                    if ((INT)pFirst & (__DOUBLE_ALIGN-1)) {
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  1422
                        int delta = __DOUBLE_ALIGN - ((INT)pFirst & (__DOUBLE_ALIGN-1));
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  1423
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  1424
                        pFirst += delta;
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  1425
                        nIndex -= delta;
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  1426
                    }
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1427
#endif
19451
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  1428
                    /* fall into */
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  1429
                case __MASKSMALLINT(BYTEARRAY):
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  1430
                case __MASKSMALLINT(WORDARRAY):
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  1431
                case __MASKSMALLINT(LONGARRAY):
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  1432
                case __MASKSMALLINT(SWORDARRAY):
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  1433
                case __MASKSMALLINT(SLONGARRAY):
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  1434
                case __MASKSMALLINT(FLOATARRAY):
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  1435
                    if ((unsigned)indx < (unsigned)nIndex) {
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  1436
                        RETURN ( __mkSmallInteger( (INT)(pFirst[indx])) );
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  1437
                    }
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  1438
                    break;
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  1439
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  1440
                case __MASKSMALLINT(LONGLONGARRAY):
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  1441
                case __MASKSMALLINT(SLONGLONGARRAY):
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1442
#ifdef __NEED_LONGLONG_ALIGN
19451
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  1443
                    if ((INT)pFirst & (__LONGLONG_ALIGN-1)) {
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  1444
                        int delta = __LONGLONG_ALIGN - ((INT)pFirst & (__LONGLONG_ALIGN-1));
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  1445
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  1446
                        pFirst += delta;
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  1447
                        nIndex -= delta;
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  1448
                    }
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1449
#endif
19451
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  1450
                    if ((unsigned)indx < (unsigned)nIndex) {
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  1451
                        RETURN ( __mkSmallInteger( (INT)(pFirst[indx])) );
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  1452
                    }
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  1453
                    break;
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  1454
            }
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  1455
        }
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1456
    }
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1457
%}.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1458
    "/ index not integer or index out of range
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1459
    "/ or non-byte indexable receiver
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1460
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1461
    ^ self primitiveFailed
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1462
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1463
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1464
     Point new byteAt:1
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1465
     (ByteArray with:1 with:2) byteAt:2
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  1466
     (WordArray with:1) byteAt:1
19841
b0023122a5aa #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 19802
diff changeset
  1467
     (WordArray with:1) byteAt:2
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  1468
     (FloatArray with:1.0) byteAt:2
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  1469
     'hello' byteAt:1
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1470
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1471
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1472
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1473
byteAt:index put:byteValue
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  1474
    "set the byte at index.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1475
     This is only allowed for non-pointer indexed objects
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1476
     (i.e. byteArrays, wordArrays, floatArrays etc.).
19451
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  1477
     The receiver's indexed instvars are treated as an uninterpreted
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1478
     collection of bytes.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1479
     Only useful with binary storage."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1480
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1481
%{  /* NOCONTEXT */
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1482
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1483
    REGISTER int indx;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1484
    int val, nIndex;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1485
    REGISTER OBJ slf;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1486
    REGISTER OBJ cls;
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
    if (__bothSmallInteger(index, byteValue)) {
19451
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  1489
        val = __intVal(byteValue);
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  1490
        if ((unsigned)(val) <= 0xFF /* i.e. (val >= 0) && (val <= 255) */) {
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  1491
            slf = self;
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  1492
            if (__isNonNilObject(slf)) {
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  1493
                cls = __qClass(slf);
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  1494
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  1495
                indx = __intVal(index) - 1;
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  1496
                switch ((INT)(__ClassInstPtr(cls)->c_flags) & __MASKSMALLINT(ARRAYMASK)) {
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  1497
                    case __MASKSMALLINT(BYTEARRAY):
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  1498
                    case __MASKSMALLINT(WORDARRAY):
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  1499
                    case __MASKSMALLINT(LONGARRAY):
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  1500
                    case __MASKSMALLINT(SWORDARRAY):
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  1501
                    case __MASKSMALLINT(SLONGARRAY):
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  1502
                    case __MASKSMALLINT(LONGLONGARRAY):
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  1503
                    case __MASKSMALLINT(SLONGLONGARRAY):
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  1504
                    case __MASKSMALLINT(FLOATARRAY):
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  1505
                    case __MASKSMALLINT(DOUBLEARRAY):
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  1506
                        indx += __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars));
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  1507
                        nIndex = __byteArraySize(slf);
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  1508
                        if ((unsigned)indx < (unsigned)nIndex) {
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  1509
                            __ByteArrayInstPtr(slf)->ba_element[indx] = val;
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  1510
                            RETURN ( byteValue );
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  1511
                        }
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  1512
                        break;
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  1513
                }
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  1514
            }
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  1515
        }
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1516
    }
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1517
%}.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1518
    "/ index not integer or index out of range
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1519
    "/ or non-byte indexable receiver
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1520
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1521
    ^ self primitiveFailed
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
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1524
     (ByteArray with:1 with:2) byteAt:2 put:3; yourself
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  1525
     'hello' copy byteAt:1 put:105; yourself
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1526
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1527
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1528
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1529
instVarAt:index
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1530
    "return a non-indexed instance variable;
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  1531
     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
  1532
     - use with care (needed for copy, inspector etc.)"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1533
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1534
%{  /* NOCONTEXT */
18254
aba026de53b8 comments
Claus Gittinger <cg@exept.de>
parents: 18240
diff changeset
  1535
#ifdef __SCHTEAM__
aba026de53b8 comments
Claus Gittinger <cg@exept.de>
parents: 18240
diff changeset
  1536
    return context._RETURN( self.instVarAt(index.intValue()-1) );
aba026de53b8 comments
Claus Gittinger <cg@exept.de>
parents: 18240
diff changeset
  1537
#else
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1538
    OBJ myClass;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1539
    int idx, ninstvars;
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
    if (__isSmallInteger(index)) {
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1542
        myClass = __Class(self);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1543
        idx = __intVal(index) - 1;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1544
        /*
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1545
         * do not allow returning of non-object fields.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1546
         * if subclass did not make provisions for that,
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1547
         * we won't do so here ...
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1548
         */
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1549
        if (((INT)(__ClassInstPtr(myClass)->c_flags) & __MASKSMALLINT(NONOBJECT_INSTS))) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1550
            if (idx == 0) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1551
                RETURN ( nil )
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1552
            }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1553
        }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1554
        ninstvars = __intVal(__ClassInstPtr(myClass)->c_ninstvars);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1555
        if ((idx >= 0) && (idx < ninstvars)) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1556
            // do not trust the ninstvars slot - verify
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1557
            if ((__OBJS2BYTES__(ninstvars) + OHDR_SIZE) <= __qSize(self)) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1558
                RETURN ( __InstPtr(self)->i_instvars[idx] );
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1559
            }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1560
            console_printf("[VM] warning: bad ninsts in class\n");
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1561
        }
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1562
    }
18254
aba026de53b8 comments
Claus Gittinger <cg@exept.de>
parents: 18240
diff changeset
  1563
#endif /* not SCHTEAM */
7216
59bfa2ffdcf7 utility
Claus Gittinger <cg@exept.de>
parents: 7215
diff changeset
  1564
%}.
59bfa2ffdcf7 utility
Claus Gittinger <cg@exept.de>
parents: 7215
diff changeset
  1565
    ^ self indexNotIntegerOrOutOfBounds:index
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1566
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1567
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1568
instVarAt:index put:value
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1569
    "change a non-indexed instance variable;
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  1570
     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
  1571
     - use with care (needed for copy, inspector etc.)"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1572
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1573
%{  /* NOCONTEXT */
18254
aba026de53b8 comments
Claus Gittinger <cg@exept.de>
parents: 18240
diff changeset
  1574
#ifdef __SCHTEAM__
aba026de53b8 comments
Claus Gittinger <cg@exept.de>
parents: 18240
diff changeset
  1575
    self.instVarAt_put(index.intValue()-1, value);
aba026de53b8 comments
Claus Gittinger <cg@exept.de>
parents: 18240
diff changeset
  1576
    return context._RETURN( value );
aba026de53b8 comments
Claus Gittinger <cg@exept.de>
parents: 18240
diff changeset
  1577
#else
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1578
    OBJ myClass;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1579
    int idx, ninstvars;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1580
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1581
    if (__isSmallInteger(index)) {
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1582
        myClass = __Class(self);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1583
        idx = __intVal(index) - 1;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1584
        ninstvars = __intVal(__ClassInstPtr(myClass)->c_ninstvars);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1585
        /*
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1586
         * do not allow setting of non-object fields.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1587
         * if subclass did not make provisions for that,
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1588
         * we won't do so here ...
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1589
         */
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1590
        if (((INT)(__ClassInstPtr(myClass)->c_flags) & __MASKSMALLINT(NONOBJECT_INSTS))) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1591
            if (idx == 0) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1592
                RETURN ( nil )
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1593
            }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1594
        }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1595
        if ((idx >= 0) && (idx < ninstvars)) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1596
            // do not trust the ninstvars slot - verify
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1597
            if ((__OBJS2BYTES__(ninstvars) + OHDR_SIZE) <= __qSize(self)) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1598
                __InstPtr(self)->i_instvars[idx] = value;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1599
                __STORE(self, value);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1600
                RETURN ( value );
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1601
            }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1602
            console_printf("[VM] warning: bad ninsts in class\n");
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1603
        }
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1604
    }
18254
aba026de53b8 comments
Claus Gittinger <cg@exept.de>
parents: 18240
diff changeset
  1605
#endif /* not SCHTEAM */
7216
59bfa2ffdcf7 utility
Claus Gittinger <cg@exept.de>
parents: 7215
diff changeset
  1606
%}.
59bfa2ffdcf7 utility
Claus Gittinger <cg@exept.de>
parents: 7215
diff changeset
  1607
    ^ self indexNotIntegerOrOutOfBounds:index
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1608
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1609
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  1610
instVarNamed:name
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1611
    "return a non-indexed instance variables value by name;
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  1612
     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
  1613
     - 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
  1614
     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
  1615
     parsed ad runtime)"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1616
10918
a4635305501e #instVarNamed* - raise KeyNotFoundError if an instaver does not exist
Stefan Vogel <sv@exept.de>
parents: 10877
diff changeset
  1617
    |idx|
a4635305501e #instVarNamed* - raise KeyNotFoundError if an instaver does not exist
Stefan Vogel <sv@exept.de>
parents: 10877
diff changeset
  1618
15449
2a27aa34e65b class: Object
Claus Gittinger <cg@exept.de>
parents: 15439
diff changeset
  1619
    idx := self class instVarIndexFor:name.
10918
a4635305501e #instVarNamed* - raise KeyNotFoundError if an instaver does not exist
Stefan Vogel <sv@exept.de>
parents: 10877
diff changeset
  1620
    idx isNil ifTrue:[
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1621
        ^ self errorKeyNotFound:name.
11335
c061d08b766f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11314
diff changeset
  1622
    ].
10918
a4635305501e #instVarNamed* - raise KeyNotFoundError if an instaver does not exist
Stefan Vogel <sv@exept.de>
parents: 10877
diff changeset
  1623
    ^ self instVarAt:idx.
5755
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
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1627
     |p|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1628
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1629
     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
  1630
     p instVarNamed:'cx'
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1631
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1632
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1633
    "Modified: 19.4.1996 / 11:12:39 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1634
!
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
instVarNamed:name ifAbsent:exceptionBlock
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1637
    "return a non-indexed instance variables value by name,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1638
     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
  1639
     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
  1640
     - 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
  1641
     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
  1642
     parsed ad runtime)"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1643
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1644
    |idx|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1645
15449
2a27aa34e65b class: Object
Claus Gittinger <cg@exept.de>
parents: 15439
diff changeset
  1646
    idx := self class instVarIndexFor:name.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1647
    idx isNil ifTrue:[^ exceptionBlock value].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1648
    ^ self instVarAt:idx
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1649
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1650
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1651
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1652
     |p|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1653
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1654
     p := Point x:10 y:20.
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  1655
     p instVarNamed:'x'
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1656
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1657
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1658
    "Created: 6.7.1996 / 23:02:49 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1659
    "Modified: 6.7.1996 / 23:03:41 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1660
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1661
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1662
instVarNamed:name put:value
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1663
    "set a non-indexed instance variable by name;
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  1664
     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
  1665
     - if at all, use with care (provided for protocol completeness).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1666
     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
  1667
     parsed ad runtime)"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1668
10918
a4635305501e #instVarNamed* - raise KeyNotFoundError if an instaver does not exist
Stefan Vogel <sv@exept.de>
parents: 10877
diff changeset
  1669
    |idx|
a4635305501e #instVarNamed* - raise KeyNotFoundError if an instaver does not exist
Stefan Vogel <sv@exept.de>
parents: 10877
diff changeset
  1670
15449
2a27aa34e65b class: Object
Claus Gittinger <cg@exept.de>
parents: 15439
diff changeset
  1671
    idx := self class instVarIndexFor:name.
10918
a4635305501e #instVarNamed* - raise KeyNotFoundError if an instaver does not exist
Stefan Vogel <sv@exept.de>
parents: 10877
diff changeset
  1672
    idx isNil ifTrue:[
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1673
        ^ self errorKeyNotFound:name.
11335
c061d08b766f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11314
diff changeset
  1674
    ].
10918
a4635305501e #instVarNamed* - raise KeyNotFoundError if an instaver does not exist
Stefan Vogel <sv@exept.de>
parents: 10877
diff changeset
  1675
    ^ self instVarAt:idx put:value.
5755
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
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1678
     |p|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1679
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1680
     p := Point x:10 y:20.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1681
     p instVarNamed:'x' put:30.
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  1682
     p
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1683
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1684
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1685
    "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
  1686
!
a4635305501e #instVarNamed* - raise KeyNotFoundError if an instaver does not exist
Stefan Vogel <sv@exept.de>
parents: 10877
diff changeset
  1687
a4635305501e #instVarNamed* - raise KeyNotFoundError if an instaver does not exist
Stefan Vogel <sv@exept.de>
parents: 10877
diff changeset
  1688
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
  1689
    "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
  1690
     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
  1691
     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
  1692
     - 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
  1693
     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
  1694
     parsed ad runtime)"
a4635305501e #instVarNamed* - raise KeyNotFoundError if an instaver does not exist
Stefan Vogel <sv@exept.de>
parents: 10877
diff changeset
  1695
a4635305501e #instVarNamed* - raise KeyNotFoundError if an instaver does not exist
Stefan Vogel <sv@exept.de>
parents: 10877
diff changeset
  1696
    |idx|
a4635305501e #instVarNamed* - raise KeyNotFoundError if an instaver does not exist
Stefan Vogel <sv@exept.de>
parents: 10877
diff changeset
  1697
15449
2a27aa34e65b class: Object
Claus Gittinger <cg@exept.de>
parents: 15439
diff changeset
  1698
    idx := self class instVarIndexFor:name.
10918
a4635305501e #instVarNamed* - raise KeyNotFoundError if an instaver does not exist
Stefan Vogel <sv@exept.de>
parents: 10877
diff changeset
  1699
    idx isNil ifTrue:[^ exceptionBlock value].
a4635305501e #instVarNamed* - raise KeyNotFoundError if an instaver does not exist
Stefan Vogel <sv@exept.de>
parents: 10877
diff changeset
  1700
    ^ self instVarAt:idx put:anObject.
a4635305501e #instVarNamed* - raise KeyNotFoundError if an instaver does not exist
Stefan Vogel <sv@exept.de>
parents: 10877
diff changeset
  1701
a4635305501e #instVarNamed* - raise KeyNotFoundError if an instaver does not exist
Stefan Vogel <sv@exept.de>
parents: 10877
diff changeset
  1702
a4635305501e #instVarNamed* - raise KeyNotFoundError if an instaver does not exist
Stefan Vogel <sv@exept.de>
parents: 10877
diff changeset
  1703
    "
a4635305501e #instVarNamed* - raise KeyNotFoundError if an instaver does not exist
Stefan Vogel <sv@exept.de>
parents: 10877
diff changeset
  1704
     |p|
a4635305501e #instVarNamed* - raise KeyNotFoundError if an instaver does not exist
Stefan Vogel <sv@exept.de>
parents: 10877
diff changeset
  1705
a4635305501e #instVarNamed* - raise KeyNotFoundError if an instaver does not exist
Stefan Vogel <sv@exept.de>
parents: 10877
diff changeset
  1706
     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
  1707
     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
  1708
     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
  1709
     p inspect.
a4635305501e #instVarNamed* - raise KeyNotFoundError if an instaver does not exist
Stefan Vogel <sv@exept.de>
parents: 10877
diff changeset
  1710
    "
a4635305501e #instVarNamed* - raise KeyNotFoundError if an instaver does not exist
Stefan Vogel <sv@exept.de>
parents: 10877
diff changeset
  1711
a4635305501e #instVarNamed* - raise KeyNotFoundError if an instaver does not exist
Stefan Vogel <sv@exept.de>
parents: 10877
diff changeset
  1712
    "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
  1713
    "Modified: 6.7.1996 / 23:03:41 / cg"
16125
2096ee4fa6bd class: Object
Stefan Vogel <sv@exept.de>
parents: 16052
diff changeset
  1714
!
2096ee4fa6bd class: Object
Stefan Vogel <sv@exept.de>
parents: 16052
diff changeset
  1715
2096ee4fa6bd class: Object
Stefan Vogel <sv@exept.de>
parents: 16052
diff changeset
  1716
nilAllInstvars
18254
aba026de53b8 comments
Claus Gittinger <cg@exept.de>
parents: 18240
diff changeset
  1717
    "overwrite all inst vars of the object with nil.
aba026de53b8 comments
Claus Gittinger <cg@exept.de>
parents: 18240
diff changeset
  1718
     Used by the crypto package to clear objects with
aba026de53b8 comments
Claus Gittinger <cg@exept.de>
parents: 18240
diff changeset
  1719
     keys when no longer in use."
16230
e5de942a1a19 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 16229
diff changeset
  1720
16125
2096ee4fa6bd class: Object
Stefan Vogel <sv@exept.de>
parents: 16052
diff changeset
  1721
%{  /* NOCONTEXT */
2096ee4fa6bd class: Object
Stefan Vogel <sv@exept.de>
parents: 16052
diff changeset
  1722
    int flags;
2096ee4fa6bd class: Object
Stefan Vogel <sv@exept.de>
parents: 16052
diff changeset
  1723
2096ee4fa6bd class: Object
Stefan Vogel <sv@exept.de>
parents: 16052
diff changeset
  1724
    if (!__isNonNilObject(self)) {
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1725
        RETURN(self);
16125
2096ee4fa6bd class: Object
Stefan Vogel <sv@exept.de>
parents: 16052
diff changeset
  1726
    }
2096ee4fa6bd class: Object
Stefan Vogel <sv@exept.de>
parents: 16052
diff changeset
  1727
    /*
2096ee4fa6bd class: Object
Stefan Vogel <sv@exept.de>
parents: 16052
diff changeset
  1728
     * bail out for special (weak) objects ..
2096ee4fa6bd class: Object
Stefan Vogel <sv@exept.de>
parents: 16052
diff changeset
  1729
     */
2096ee4fa6bd class: Object
Stefan Vogel <sv@exept.de>
parents: 16052
diff changeset
  1730
    flags = __intVal(__ClassInstPtr(__qClass(self))->c_flags);
2096ee4fa6bd class: Object
Stefan Vogel <sv@exept.de>
parents: 16052
diff changeset
  1731
    if (((flags & ~ARRAYMASK) == 0)
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1732
        && ((flags & ARRAYMASK) != WKPOINTERARRAY)
16125
2096ee4fa6bd class: Object
Stefan Vogel <sv@exept.de>
parents: 16052
diff changeset
  1733
    ) {
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1734
        bzero((void *)__InstPtr(self)->i_instvars, __qSize(self)-OHDR_SIZE);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1735
        RETURN(self);
16125
2096ee4fa6bd class: Object
Stefan Vogel <sv@exept.de>
parents: 16052
diff changeset
  1736
    }
2096ee4fa6bd class: Object
Stefan Vogel <sv@exept.de>
parents: 16052
diff changeset
  1737
%}.
2096ee4fa6bd class: Object
Stefan Vogel <sv@exept.de>
parents: 16052
diff changeset
  1738
    "/ fail for special objects
2096ee4fa6bd class: Object
Stefan Vogel <sv@exept.de>
parents: 16052
diff changeset
  1739
    ^ self primitiveFailed
2096ee4fa6bd class: Object
Stefan Vogel <sv@exept.de>
parents: 16052
diff changeset
  1740
2096ee4fa6bd class: Object
Stefan Vogel <sv@exept.de>
parents: 16052
diff changeset
  1741
    "
2096ee4fa6bd class: Object
Stefan Vogel <sv@exept.de>
parents: 16052
diff changeset
  1742
      'abcdef' copy nilAllInstvars
2096ee4fa6bd class: Object
Stefan Vogel <sv@exept.de>
parents: 16052
diff changeset
  1743
      100 factorial nilAllInstvars
2096ee4fa6bd class: Object
Stefan Vogel <sv@exept.de>
parents: 16052
diff changeset
  1744
    "
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1745
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1746
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1747
!Object methodsFor:'attributes access'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1748
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  1749
objectAttributeAt:attributeKey
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1750
    "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
  1751
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1752
    | attrs |
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1753
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1754
    attrs := self objectAttributes.
17174
c78f65f2f43d class: Object
Stefan Vogel <sv@exept.de>
parents: 17168
diff changeset
  1755
    attrs size ~~ 0 ifTrue:[
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1756
        ^ attrs at:attributeKey ifAbsent:[]
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1757
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1758
    ^ nil
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1759
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1760
    "Created: / 22.1.1998 / 21:29:17 / av"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1761
    "Modified: / 3.2.1998 / 18:55:55 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1762
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1763
6323
9dbabd4270d3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6321
diff changeset
  1764
objectAttributeAt:attributeKey put:anObject
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1765
    "store the attribute anObject referenced by key into the receiver"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1766
16291
5fa03fd6dd29 class: Object
Claus Gittinger <cg@exept.de>
parents: 16251
diff changeset
  1767
    "/ must do this save from being reentered, since the attributes collection
5fa03fd6dd29 class: Object
Claus Gittinger <cg@exept.de>
parents: 16251
diff changeset
  1768
    "/ is possibly accessed from multiple threads...
5fa03fd6dd29 class: Object
Claus Gittinger <cg@exept.de>
parents: 16251
diff changeset
  1769
    ObjectAttributesAccessLock critical:[
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1770
        | attrs |
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1771
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1772
        attrs := self objectAttributes.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1773
        "/ only need a WeakIdentityDictionary, if there are any non-symbol keys in
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1774
        "/ it. Start with a regular IDDict, and migrate to WeakIDDict if ever required.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1775
        "/ Typically, this never happens (but does in the UIPainter!!)
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1776
        attrs isEmptyOrNil ifTrue:[
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1777
            attributeKey isSymbol ifTrue:[
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1778
                attrs := IdentityDictionary new.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1779
            ] ifFalse:[
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1780
                attrs := WeakIdentityDictionary new.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1781
            ].
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1782
            attrs at:attributeKey put:anObject.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1783
            self objectAttributes:attrs.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1784
        ] ifFalse:[
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1785
            attributeKey isSymbol ifFalse:[
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1786
                attrs isWeakCollection ifFalse:[
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1787
                    "first non-symbol attributeKey - convert to WeakIdentityDictionary"
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1788
                    attrs := WeakIdentityDictionary new declareAllFrom:attrs.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1789
                    self objectAttributes:attrs.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1790
                ].
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1791
            ].
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1792
            attrs at:attributeKey put:anObject.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1793
        ].
16291
5fa03fd6dd29 class: Object
Claus Gittinger <cg@exept.de>
parents: 16251
diff changeset
  1794
    ]
5755
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
    "Attaching additional attributes (slots) to an arbitrary object:
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
     |p|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1799
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1800
     p := Point new.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1801
     p objectAttributeAt:#color put:#green.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1802
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1803
     p objectAttributeAt:#color
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1804
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1805
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1806
    "Created: / 22.1.1998 / 21:29:25 / av"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1807
    "Modified: / 3.2.1998 / 18:57:58 / cg"
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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1810
objectAttributes
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1811
    "return a Collection of attributes - nil if there is none.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1812
     The default implementation here uses a global WeakDictionary to store
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1813
     attributes
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1814
     This may be too slow for high frequency slot access,
13416
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  1815
     therefore, some classes may redefine this for better performnce.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1816
     Notice the mentioning of a WeakDictionary - read the classes documentation."
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
    ^ ObjectAttributes at:self ifAbsent:[nil]
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1819
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1820
    "Created: / 22.1.1998 / 21:29:30 / av"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1821
    "Modified: / 18.2.2000 / 11:34:16 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1822
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1823
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1824
objectAttributes:aCollection
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1825
    "set the collection of attributes.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1826
     The default implementation here uses a global Dictionary to store
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1827
     attributes which may be too slow for high frequency change&update.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1828
     Therefore, some classes may redefine this for better performance."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1829
16291
5fa03fd6dd29 class: Object
Claus Gittinger <cg@exept.de>
parents: 16251
diff changeset
  1830
    "/ must do this save from being reentered, since the attributes collection
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1831
    "/ is possibly accessed from multiple threads.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1832
16291
5fa03fd6dd29 class: Object
Claus Gittinger <cg@exept.de>
parents: 16251
diff changeset
  1833
    ObjectAttributesAccessLock critical:[
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1834
        aCollection isEmptyOrNil ifTrue:[
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1835
            ObjectAttributes removeKey:self ifAbsent:nil
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1836
        ] ifFalse:[
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1837
            ObjectAttributes at:self put:aCollection
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1838
        ].
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1839
    ]
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1840
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1841
    "Created: / 22.1.1998 / 21:29:35 / av"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1842
    "Modified: / 3.2.1998 / 18:58:10 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1843
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1844
6323
9dbabd4270d3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6321
diff changeset
  1845
removeObjectAttribute:attributeKey
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1846
    "remove an object attribute;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1847
     return the value previously stored there, or nil.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1848
     (make the argument, anObject be no longer an attribute of the receiver)"
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1849
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1850
    |oldVal|
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1851
    
16291
5fa03fd6dd29 class: Object
Claus Gittinger <cg@exept.de>
parents: 16251
diff changeset
  1852
    "/ must do this save from being reentered, since the attributes collection
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1853
    "/ is possibly accessed from multiple threads.
16291
5fa03fd6dd29 class: Object
Claus Gittinger <cg@exept.de>
parents: 16251
diff changeset
  1854
    ObjectAttributesAccessLock critical:[
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1855
        |attrs|
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1856
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1857
        attrs := self objectAttributes.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1858
        attrs notNil ifTrue:[
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1859
            attrs size ~~ 0 ifTrue:[
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1860
                oldVal := attrs removeKey:attributeKey ifAbsent:nil.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1861
            ].
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1862
            attrs size == 0 ifTrue:[
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1863
                self objectAttributes:nil
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1864
            ].
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1865
        ]
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1866
    ].
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1867
    ^ oldVal
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1868
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1869
    "Created: / 22.1.1998 / 21:29:39 / av"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1870
    "Modified: / 18.2.2000 / 11:32:19 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1871
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1872
13500
51b2e6c6c2ac changed:
Claus Gittinger <cg@exept.de>
parents: 13488
diff changeset
  1873
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1874
!Object methodsFor:'change & update'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1875
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1876
broadcast:aSelectorSymbol
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1877
    "send a message with selector aSelectorSymbol to all my dependents"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1878
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  1879
    self dependentsDo:[:dependent |
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1880
        dependent perform:aSelectorSymbol
5755
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
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1883
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1884
broadcast:aSelectorSymbol with:anArgument
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1885
    "send a message with selector aSelectorSymbol with an additional
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1886
     argument anArgument to all my dependents."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1887
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  1888
    self dependentsDo:[:dependent |
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1889
        dependent perform:aSelectorSymbol with:anArgument
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1890
    ]
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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1893
changeRequest
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1894
    "the receiver wants to change - check if all dependents
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1895
     grant the request, and return true if so"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1896
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  1897
    self dependentsDo:[:dependent |
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1898
        dependent updateRequest ifFalse:[^ false].
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1899
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1900
    ^ true
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
11551
170f7fae1bfc updateRequest
Claus Gittinger <cg@exept.de>
parents: 11541
diff changeset
  1903
changeRequest:aSymbol
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1904
    "the receiver wants to change - check if all dependents
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1905
     grant the request, and return true if so"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1906
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  1907
    self dependentsDo:[:dependent |
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1908
        (dependent updateRequest:aSymbol) ifFalse:[^ false].
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1909
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1910
    ^ true
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1911
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1912
11551
170f7fae1bfc updateRequest
Claus Gittinger <cg@exept.de>
parents: 11541
diff changeset
  1913
changeRequest:aSymbol from:anObject
170f7fae1bfc updateRequest
Claus Gittinger <cg@exept.de>
parents: 11541
diff changeset
  1914
    "the receiver wants to change - check if all dependents
170f7fae1bfc updateRequest
Claus Gittinger <cg@exept.de>
parents: 11541
diff changeset
  1915
     except anObject grant the request, and return true if so.
170f7fae1bfc updateRequest
Claus Gittinger <cg@exept.de>
parents: 11541
diff changeset
  1916
     The argument anObject is typically going to be the one who is
170f7fae1bfc updateRequest
Claus Gittinger <cg@exept.de>
parents: 11541
diff changeset
  1917
     about to send the change request."
170f7fae1bfc updateRequest
Claus Gittinger <cg@exept.de>
parents: 11541
diff changeset
  1918
170f7fae1bfc updateRequest
Claus Gittinger <cg@exept.de>
parents: 11541
diff changeset
  1919
    ^ self changeRequest:aSymbol with:nil from:anObject
170f7fae1bfc updateRequest
Claus Gittinger <cg@exept.de>
parents: 11541
diff changeset
  1920
!
170f7fae1bfc updateRequest
Claus Gittinger <cg@exept.de>
parents: 11541
diff changeset
  1921
170f7fae1bfc updateRequest
Claus Gittinger <cg@exept.de>
parents: 11541
diff changeset
  1922
changeRequest:aSymbol with:aParameter
170f7fae1bfc updateRequest
Claus Gittinger <cg@exept.de>
parents: 11541
diff changeset
  1923
    "the receiver wants to change - check if all dependents
170f7fae1bfc updateRequest
Claus Gittinger <cg@exept.de>
parents: 11541
diff changeset
  1924
     grant the request, and return true if so"
170f7fae1bfc updateRequest
Claus Gittinger <cg@exept.de>
parents: 11541
diff changeset
  1925
11573
cc09bff8a992 *** empty log message ***
ca
parents: 11551
diff changeset
  1926
    ^ self changeRequest:aSymbol with:aParameter from:self
11551
170f7fae1bfc updateRequest
Claus Gittinger <cg@exept.de>
parents: 11541
diff changeset
  1927
!
170f7fae1bfc updateRequest
Claus Gittinger <cg@exept.de>
parents: 11541
diff changeset
  1928
170f7fae1bfc updateRequest
Claus Gittinger <cg@exept.de>
parents: 11541
diff changeset
  1929
changeRequest:aSymbol with:aParameter from:anObject
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1930
    "the receiver wants to change - check if all dependents
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1931
     except anObject grant the request, and return true if so.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1932
     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
  1933
     about to send the change request."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1934
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  1935
    self dependentsDo:[:dependent |
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1936
        dependent == anObject ifFalse:[
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1937
            (dependent updateRequest:aSymbol with:aParameter from:anObject) ifFalse:[^ false].
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1938
        ]
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1939
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1940
    ^ true
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1941
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1942
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1943
changeRequestFrom:anObject
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1944
    "the receiver wants to change - check if all dependents
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1945
     except anObject grant the request, and return true if so.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1946
     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
  1947
     about to send the change request."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1948
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  1949
    self dependentsDo:[:dependent |
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1950
        dependent == anObject ifFalse:[
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1951
            (dependent updateRequest) ifFalse:[^ false].
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1952
        ]
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1953
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1954
    ^ true
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1955
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1956
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1957
changed
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1958
    "notify all dependents that the receiver has changed.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1959
     Each dependent gets a '#update:'-message with the original
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1960
     receiver as argument."
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 changed:nil
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
changed:aParameter
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1966
    "notify all dependents that the receiver has changed somehow.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1967
     Each dependent gets a '#update:'-message with aParameter
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1968
     as argument."
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
    self changed:aParameter with:nil
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1971
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1972
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1973
changed:aParameter with:anArgument
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1974
    "notify all dependents that the receiver has changed somehow.
19583
af9f1124bd5a #DOCUMENTATION by Maren
matilk
parents: 19550
diff changeset
  1975
     Each dependent gets an '#update:with:from:'-message, with aParameter
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1976
     and anArgument as arguments."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1977
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  1978
    self dependentsDo:[:dependent |
19583
af9f1124bd5a #DOCUMENTATION by Maren
matilk
parents: 19550
diff changeset
  1979
        dependent update:aParameter with:anArgument from:self
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1980
    ]
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1981
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1982
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1983
update:aParameter
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1984
    "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
  1985
     on whom the receiver depends, has changed. The argument aParameter
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1986
     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
  1987
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1988
     Default behavior here is to do nothing"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1989
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1990
    ^ self
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1991
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1992
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1993
update:aParameter with:anArgument
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1994
    "dependent is notified of some change -
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1995
     Default is to try update:"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1996
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1997
    ^ self update:aParameter
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1998
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1999
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2000
update:aParameter with:anArgument from:sender
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2001
    "dependent is notified of some change -
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2002
     Default is to try update:with:"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2003
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2004
    ^ self update:aParameter with:anArgument
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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2007
updateRequest
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2008
    "return true, if an update request is granted.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2009
     Default here is to grant updates - may be used
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2010
     to lock updates if someone is making other changes
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2011
     from within an update. Or if someone has locked its
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2012
     state and does not want others to change things.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2013
     However, these dependents must all honor the
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2014
     changeRequest - ifTrue - change protocol. I.e. they
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2015
     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
  2016
     it returns true. The others must decide in updateRequest and
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2017
     return true if they think a change is ok."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2018
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2019
    ^ true
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2020
!
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
updateRequest:aSymbol
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2023
    "return true, if an update request is granted.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2024
     Default here a simple updateRequest"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2025
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2026
    ^ self updateRequest
7177
2bfa42d795a0 added withoutUpdating:do:
martin
parents: 7159
diff changeset
  2027
!
2bfa42d795a0 added withoutUpdating:do:
martin
parents: 7159
diff changeset
  2028
11551
170f7fae1bfc updateRequest
Claus Gittinger <cg@exept.de>
parents: 11541
diff changeset
  2029
updateRequest:aSymbol with:aParameter
170f7fae1bfc updateRequest
Claus Gittinger <cg@exept.de>
parents: 11541
diff changeset
  2030
    "return true, if an update request is granted.
170f7fae1bfc updateRequest
Claus Gittinger <cg@exept.de>
parents: 11541
diff changeset
  2031
     Default here a simple updateRequest"
170f7fae1bfc updateRequest
Claus Gittinger <cg@exept.de>
parents: 11541
diff changeset
  2032
170f7fae1bfc updateRequest
Claus Gittinger <cg@exept.de>
parents: 11541
diff changeset
  2033
    ^ self updateRequest:aSymbol
170f7fae1bfc updateRequest
Claus Gittinger <cg@exept.de>
parents: 11541
diff changeset
  2034
!
170f7fae1bfc updateRequest
Claus Gittinger <cg@exept.de>
parents: 11541
diff changeset
  2035
170f7fae1bfc updateRequest
Claus Gittinger <cg@exept.de>
parents: 11541
diff changeset
  2036
updateRequest:aSymbol with:aParameter from:sender
170f7fae1bfc updateRequest
Claus Gittinger <cg@exept.de>
parents: 11541
diff changeset
  2037
    "return true, if an update request is granted.
170f7fae1bfc updateRequest
Claus Gittinger <cg@exept.de>
parents: 11541
diff changeset
  2038
     Default here a simple updateRequest"
170f7fae1bfc updateRequest
Claus Gittinger <cg@exept.de>
parents: 11541
diff changeset
  2039
170f7fae1bfc updateRequest
Claus Gittinger <cg@exept.de>
parents: 11541
diff changeset
  2040
    ^ self updateRequest:aSymbol with:aParameter
170f7fae1bfc updateRequest
Claus Gittinger <cg@exept.de>
parents: 11541
diff changeset
  2041
!
170f7fae1bfc updateRequest
Claus Gittinger <cg@exept.de>
parents: 11541
diff changeset
  2042
7177
2bfa42d795a0 added withoutUpdating:do:
martin
parents: 7159
diff changeset
  2043
withoutUpdating:someone do:aBlock
2bfa42d795a0 added withoutUpdating:do:
martin
parents: 7159
diff changeset
  2044
    "evaluate a block but remove someone from my dependents temporarily"
2bfa42d795a0 added withoutUpdating:do:
martin
parents: 7159
diff changeset
  2045
2bfa42d795a0 added withoutUpdating:do:
martin
parents: 7159
diff changeset
  2046
    (self dependents includesIdentical:someone)
2bfa42d795a0 added withoutUpdating:do:
martin
parents: 7159
diff changeset
  2047
    ifFalse:[
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2048
        ^ aBlock value.
7177
2bfa42d795a0 added withoutUpdating:do:
martin
parents: 7159
diff changeset
  2049
    ].
2bfa42d795a0 added withoutUpdating:do:
martin
parents: 7159
diff changeset
  2050
    self removeDependent:someone.
2bfa42d795a0 added withoutUpdating:do:
martin
parents: 7159
diff changeset
  2051
    ^ aBlock ensure:[ self addDependent:someone ]
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2052
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2053
20027
5be764ee44fb #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 19846
diff changeset
  2054
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2055
!Object methodsFor:'comparing'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2056
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2057
= anObject
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2058
    "return true, if the receiver and the arg have the same structure.
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2059
     Notice:
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2060
        This method is partially open coded (inlined) by the compiler(s)
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2061
        identical objects are always considered equal.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2062
        redefining it may not work as expected."
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2063
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2064
    ^ self == anObject
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2065
!
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2066
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2067
== anObject
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2068
    "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
  2069
     Never redefine this in any class.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2070
     Notice:
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2071
        This method is open coded (inlined) by the compiler(s)
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2072
        - redefining it may not work as expected."
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2073
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2074
%{  /* NOCONTEXT */
18240
28af09029a8b ifdef for SCHTEAM engine changed (not relevant for ST/X)
Claus Gittinger <cg@exept.de>
parents: 18238
diff changeset
  2075
#ifdef __SCHTEAM__
18361
6f4ec9a1b98a comments only
Claus Gittinger <cg@exept.de>
parents: 18352
diff changeset
  2076
    return context._RETURN( (self == anObject) ? STObject.True : STObject.False );
18231
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  2077
#else
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2078
    RETURN ( (self == anObject) ? true : false );
18231
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  2079
#endif
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2080
%}
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2081
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2082
5814
f4f6da3e7631 Define #deepSameContentsAs:
Stefan Vogel <sv@exept.de>
parents: 5806
diff changeset
  2083
deepSameContentsAs:anObject
f4f6da3e7631 Define #deepSameContentsAs:
Stefan Vogel <sv@exept.de>
parents: 5806
diff changeset
  2084
    "return true, if the receiver and the arg have the same contents
f4f6da3e7631 Define #deepSameContentsAs:
Stefan Vogel <sv@exept.de>
parents: 5806
diff changeset
  2085
     in both the named instance vars and any indexed instVars.
f4f6da3e7631 Define #deepSameContentsAs:
Stefan Vogel <sv@exept.de>
parents: 5806
diff changeset
  2086
     This method descends into referenced objects, where #sameContentsAs: does not descend"
f4f6da3e7631 Define #deepSameContentsAs:
Stefan Vogel <sv@exept.de>
parents: 5806
diff changeset
  2087
5821
c11bb6c8cc8f Cleanup unused method vars
Stefan Vogel <sv@exept.de>
parents: 5814
diff changeset
  2088
    |myClass val
5814
f4f6da3e7631 Define #deepSameContentsAs:
Stefan Vogel <sv@exept.de>
parents: 5806
diff changeset
  2089
     sz "{ Class: SmallInteger }" |
f4f6da3e7631 Define #deepSameContentsAs:
Stefan Vogel <sv@exept.de>
parents: 5806
diff changeset
  2090
f4f6da3e7631 Define #deepSameContentsAs:
Stefan Vogel <sv@exept.de>
parents: 5806
diff changeset
  2091
    myClass := self class.
f4f6da3e7631 Define #deepSameContentsAs:
Stefan Vogel <sv@exept.de>
parents: 5806
diff changeset
  2092
    myClass isVariable ifTrue:[
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2093
        sz := self basicSize.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2094
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2095
        "compare the indexed variables"
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2096
        1 to:sz do:[:i |
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2097
            val := self basicAt:i.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2098
            val isLiteral ifTrue:[
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2099
                val = (anObject basicAt:i) ifFalse:[^ false].
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2100
            ] ifFalse:[
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2101
                (val deepSameContentsAs:(anObject basicAt:i)) ifFalse:[^ false].
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2102
            ]
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2103
        ]
5814
f4f6da3e7631 Define #deepSameContentsAs:
Stefan Vogel <sv@exept.de>
parents: 5806
diff changeset
  2104
    ].
f4f6da3e7631 Define #deepSameContentsAs:
Stefan Vogel <sv@exept.de>
parents: 5806
diff changeset
  2105
f4f6da3e7631 Define #deepSameContentsAs:
Stefan Vogel <sv@exept.de>
parents: 5806
diff changeset
  2106
    "compare the instance variables"
f4f6da3e7631 Define #deepSameContentsAs:
Stefan Vogel <sv@exept.de>
parents: 5806
diff changeset
  2107
    sz := myClass instSize.
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  2108
    1 to:sz do:[:i |
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2109
        val := self instVarAt:i.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2110
        val isLiteral ifTrue:[
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2111
            val = (anObject instVarAt:i) ifFalse:[^ false].
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2112
        ] ifFalse:[
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2113
            (val deepSameContentsAs:(anObject instVarAt:i)) ifFalse:[^ false].
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2114
        ]
5814
f4f6da3e7631 Define #deepSameContentsAs:
Stefan Vogel <sv@exept.de>
parents: 5806
diff changeset
  2115
    ].
f4f6da3e7631 Define #deepSameContentsAs:
Stefan Vogel <sv@exept.de>
parents: 5806
diff changeset
  2116
f4f6da3e7631 Define #deepSameContentsAs:
Stefan Vogel <sv@exept.de>
parents: 5806
diff changeset
  2117
    ^ true
f4f6da3e7631 Define #deepSameContentsAs:
Stefan Vogel <sv@exept.de>
parents: 5806
diff changeset
  2118
f4f6da3e7631 Define #deepSameContentsAs:
Stefan Vogel <sv@exept.de>
parents: 5806
diff changeset
  2119
    "
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  2120
     #(1 2 3 4) deepSameContentsAs:#[1 2 3 4] asArray
5814
f4f6da3e7631 Define #deepSameContentsAs:
Stefan Vogel <sv@exept.de>
parents: 5806
diff changeset
  2121
     (1@2) deepSameContentsAs:(1->2)
f4f6da3e7631 Define #deepSameContentsAs:
Stefan Vogel <sv@exept.de>
parents: 5806
diff changeset
  2122
    "
f4f6da3e7631 Define #deepSameContentsAs:
Stefan Vogel <sv@exept.de>
parents: 5806
diff changeset
  2123
!
f4f6da3e7631 Define #deepSameContentsAs:
Stefan Vogel <sv@exept.de>
parents: 5806
diff changeset
  2124
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2125
hash
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2126
    "return an Integer useful as a hash key for the receiver.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2127
     This hash should return same values for objects with same
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2128
     contents (i.e. use this to hash on structure)"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2129
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2130
    ^ self identityHash
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2131
!
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
identityHash
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2134
    "return an Integer useful as a hash key for the receiver.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2135
     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
  2136
     this to hash on identity of objects).
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
     We cannot use the Objects address (as other smalltalks do) since
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2139
     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
  2140
     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
  2141
     Id in the object header itself as its hashed upon.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2142
     (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
  2143
     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
  2144
     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
  2145
     hashed-upon objects could add an instvar containing the hash value."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2146
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2147
%{  /* NOCONTEXT */
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2148
5806
a7361ebe686a avoid warnings on alpha (int-size)
Claus Gittinger <cg@exept.de>
parents: 5769
diff changeset
  2149
    REGISTER unsigned INT hash;
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2150
    static unsigned nextHash = 0;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2151
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2152
    if (__isNonNilObject(self)) {
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2153
        hash = __GET_HASH(self);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2154
        if (hash == 0) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2155
            /* has no hash yet */
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2156
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2157
            if (++nextHash > __MAX_HASH__) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2158
                nextHash = 1;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2159
            }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2160
            hash = nextHash;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2161
            __SET_HASH(self, hash);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2162
        }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2163
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2164
        /*
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2165
         * now, we got 11 bits for hashing;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2166
         * make it as large as possible; since most hashers use the returned
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2167
         * key and take it modulo some prime number, this will allow for
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2168
         * better distribution (i.e. bigger empty spaces) in hashed collection.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2169
         */
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2170
        hash = __MAKE_HASH__(hash);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2171
        RETURN ( __mkSmallInteger(hash) );
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2172
    }
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2173
%}.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2174
    ^ 0 "never reached, since redefined in UndefinedObject and SmallInteger"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2175
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2176
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2177
identityHashForBinaryStore
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2178
    "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
  2179
     and does not #become something else, while the hash is used.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2180
     This is only used by the binary storage mechanism, during the
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2181
     object writing phase."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2182
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2183
%{  /* NOCONTEXT */
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2184
5806
a7361ebe686a avoid warnings on alpha (int-size)
Claus Gittinger <cg@exept.de>
parents: 5769
diff changeset
  2185
    REGISTER unsigned INT hash, hash1, hash2, sz;
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2186
    OBJ o;
5806
a7361ebe686a avoid warnings on alpha (int-size)
Claus Gittinger <cg@exept.de>
parents: 5769
diff changeset
  2187
    static unsigned INT nextHash = 0;
a7361ebe686a avoid warnings on alpha (int-size)
Claus Gittinger <cg@exept.de>
parents: 5769
diff changeset
  2188
    static unsigned INT nextClassHash = 0;
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2189
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2190
    if (__isNonNilObject(self)) {
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2191
        /*
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2192
         * my own identityHash
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2193
         */
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2194
        hash1 = __GET_HASH(self);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2195
        if (hash1 == 0) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2196
            /* has no hash yet */
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2197
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2198
            if (++nextHash > __MAX_HASH__) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2199
                nextHash = 1;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2200
            }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2201
            hash1 = nextHash;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2202
            __SET_HASH(self, hash1);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2203
        }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2204
        /*
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2205
         * my classes identityHash
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2206
         */
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2207
        o = __qClass(self);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2208
        hash2 = __GET_HASH(o);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2209
        if (hash2 == 0) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2210
            /* has no hash yet */
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2211
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2212
            if (++nextClassHash > __MAX_HASH__) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2213
                nextClassHash = 1;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2214
            }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2215
            hash2 = nextClassHash;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2216
            __SET_HASH(o, hash2);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2217
        }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2218
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2219
        /*
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2220
         * some bits of my size
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2221
         */
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2222
        sz = __qSize(self);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2223
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2224
        /*
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2225
         * now, we got 11 + 11 + 8 bits for hashing;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2226
         * make it as large as possible; since most hashers use the returned
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2227
         * key and take it modulo some prime number, this will allow for
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2228
         * better distribution (i.e. bigger empty spaces) in hashed collection.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2229
         */
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2230
        hash = (hash1 << 11) | hash2;           /* 22 bits */
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2231
        hash = (hash << 8) | (sz & 0xFC);       /* 30 bits */
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2232
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2233
        while ((hash & 0x20000000) == 0) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2234
            hash <<= 1;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2235
        }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2236
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2237
        RETURN ( __mkSmallInteger(hash) );
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2238
    }
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2239
%}.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2240
    "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
  2241
    ^ self identityHash
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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2244
sameContentsAs:anObject
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2245
    "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
  2246
     in both the named instance vars and any indexed instVars.
5ce61b826f0e sameContentsAs: comment.
Claus Gittinger <cg@exept.de>
parents: 7112
diff changeset
  2247
     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
  2248
     present in the arg, not vice versa.
5ce61b826f0e sameContentsAs: comment.
Claus Gittinger <cg@exept.de>
parents: 7112
diff changeset
  2249
     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
  2250
5821
c11bb6c8cc8f Cleanup unused method vars
Stefan Vogel <sv@exept.de>
parents: 5814
diff changeset
  2251
    |myClass
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2252
     sz "{ Class: SmallInteger }" |
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2253
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2254
    myClass := self class.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2255
    myClass isVariable ifTrue:[
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2256
        sz := self basicSize.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2257
        anObject basicSize >= sz ifFalse:[^ false].
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2258
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2259
        "compare the indexed variables"
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2260
        1 to:sz do:[:i |
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2261
            (self basicAt:i) == (anObject basicAt:i) ifFalse:[^ false].
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2262
        ]
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2263
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2264
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2265
    "compare the instance variables"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2266
    sz := myClass instSize.
12997
11e3305c4a0c changed: #sameContentsAs:
sr
parents: 12841
diff changeset
  2267
    anObject class instSize >= sz ifFalse:[^ false].
7121
5ce61b826f0e sameContentsAs: comment.
Claus Gittinger <cg@exept.de>
parents: 7112
diff changeset
  2268
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  2269
    1 to:sz do:[:i |
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2270
        (self instVarAt:i) == (anObject instVarAt:i) ifFalse:[^ false].
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2271
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2272
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2273
    ^ true
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
    "
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  2276
     #(1 2 3 4) sameContentsAs:#[1 2 3 4] asArray
5814
f4f6da3e7631 Define #deepSameContentsAs:
Stefan Vogel <sv@exept.de>
parents: 5806
diff changeset
  2277
     (1@2) sameContentsAs:(1->2)
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2278
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2279
12997
11e3305c4a0c changed: #sameContentsAs:
sr
parents: 12841
diff changeset
  2280
    "Created: / 21-04-1998 / 15:56:40 / cg"
11e3305c4a0c changed: #sameContentsAs:
sr
parents: 12841
diff changeset
  2281
    "Modified: / 05-08-2010 / 16:44:09 / sr"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2282
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2283
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2284
~= anObject
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2285
    "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
  2286
     Notice:
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2287
        This method is partially open coded (inlined) by the compiler(s)
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2288
        identical objects are never considered unequal.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2289
        redefining it may not work as expected."
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2290
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2291
    ^ (self = anObject) not
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2292
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2293
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2294
~~ anObject
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2295
    "return true, if the receiver and the arg are not the same object.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2296
     Never redefine this in any class.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2297
     Notice:
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2298
        This method is open coded (inlined) by the compiler(s)
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2299
        - redefining it may not work as expected."
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2300
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2301
%{  /* NOCONTEXT */
18240
28af09029a8b ifdef for SCHTEAM engine changed (not relevant for ST/X)
Claus Gittinger <cg@exept.de>
parents: 18238
diff changeset
  2302
#ifdef __SCHTEAM__
18361
6f4ec9a1b98a comments only
Claus Gittinger <cg@exept.de>
parents: 18352
diff changeset
  2303
    return context._RETURN( (self == anObject) ? STObject.False : STObject.True );
18231
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  2304
#else
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2305
    RETURN ( (self == anObject) ? false : true );
18231
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  2306
#endif
5755
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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2310
!Object methodsFor:'converting'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2311
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2312
-> anObject
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2313
    "return an association with the receiver as key and
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2314
     the argument as value"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2315
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2316
    ^ Association key:self value:anObject
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2317
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2318
10062
c84adfadde12 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10032
diff changeset
  2319
as:aSimilarClass
16052
04691ede1f57 class: Object
Claus Gittinger <cg@exept.de>
parents: 16021
diff changeset
  2320
    "If the receiver's class is not aSimilarClass,
04691ede1f57 class: Object
Claus Gittinger <cg@exept.de>
parents: 16021
diff changeset
  2321
     create and return an instance of aSimilarClass that has the same contents
10062
c84adfadde12 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10032
diff changeset
  2322
     as the receiver.
c84adfadde12 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10032
diff changeset
  2323
     Otherwise, return the receiver."
c84adfadde12 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10032
diff changeset
  2324
c84adfadde12 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10032
diff changeset
  2325
    self class == aSimilarClass ifTrue:[^ self].
c84adfadde12 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10032
diff changeset
  2326
    ^ aSimilarClass newFrom:self
c84adfadde12 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10032
diff changeset
  2327
c84adfadde12 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10032
diff changeset
  2328
    "
c84adfadde12 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10032
diff changeset
  2329
     #[1 2 3 4] as:ByteArray
c84adfadde12 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10032
diff changeset
  2330
     #[1 2 3 4] as:Array
10539
05541b0358c2 changed #as: comment
Stefan Vogel <sv@exept.de>
parents: 10532
diff changeset
  2331
     #[81 82 83 84] as:String
05541b0358c2 changed #as: comment
Stefan Vogel <sv@exept.de>
parents: 10532
diff changeset
  2332
     #[81 82 83 84] as:Symbol
16052
04691ede1f57 class: Object
Claus Gittinger <cg@exept.de>
parents: 16021
diff changeset
  2333
     'hello' as:Unicode16String
10062
c84adfadde12 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10032
diff changeset
  2334
    "
c84adfadde12 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10032
diff changeset
  2335
!
c84adfadde12 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10032
diff changeset
  2336
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2337
asCollection
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2338
    "return myself as a Collection.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2339
     Redefined in collection to return themself."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2340
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2341
    ^ Array with:self
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2342
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2343
17261
a9bf1e05e5a2 class: Object
Claus Gittinger <cg@exept.de>
parents: 17176
diff changeset
  2344
asLink
a9bf1e05e5a2 class: Object
Claus Gittinger <cg@exept.de>
parents: 17176
diff changeset
  2345
    "return a valueLink for the receiver.
a9bf1e05e5a2 class: Object
Claus Gittinger <cg@exept.de>
parents: 17176
diff changeset
  2346
     Used to make sure the receiver can be added to a linked list"
a9bf1e05e5a2 class: Object
Claus Gittinger <cg@exept.de>
parents: 17176
diff changeset
  2347
a9bf1e05e5a2 class: Object
Claus Gittinger <cg@exept.de>
parents: 17176
diff changeset
  2348
    ^ ValueLink value:self
a9bf1e05e5a2 class: Object
Claus Gittinger <cg@exept.de>
parents: 17176
diff changeset
  2349
!
a9bf1e05e5a2 class: Object
Claus Gittinger <cg@exept.de>
parents: 17176
diff changeset
  2350
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2351
asSequenceableCollection
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2352
    "return myself as a SequenceableCollection.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2353
     Redefined in SequenceableCollection"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2354
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2355
    ^ Array with:self
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2356
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2357
14355
b5ed6aa393f7 added: #asUnicode16String
Stefan Vogel <sv@exept.de>
parents: 14296
diff changeset
  2358
asString
b5ed6aa393f7 added: #asUnicode16String
Stefan Vogel <sv@exept.de>
parents: 14296
diff changeset
  2359
    ^ self printString
b5ed6aa393f7 added: #asUnicode16String
Stefan Vogel <sv@exept.de>
parents: 14296
diff changeset
  2360
!
b5ed6aa393f7 added: #asUnicode16String
Stefan Vogel <sv@exept.de>
parents: 14296
diff changeset
  2361
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2362
asValue
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2363
    "return a valueHolder for for the receiver"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2364
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2365
    ^ ValueHolder with:self
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2366
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2367
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2368
!Object methodsFor:'copying'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2369
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  2370
cloneFrom:anObject
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2371
    "Helper for copy:
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2372
     copy all instance variables from anObject into the receiver,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2373
     which should be of the same class as the argument."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2374
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2375
    self cloneFrom:anObject performing:#yourself
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2376
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2377
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2378
     |x|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2379
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2380
     x := Array new:3.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2381
     x cloneFrom:#(1 2 3).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2382
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2383
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2384
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2385
cloneFrom:anObject performing:aSymbol
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2386
    "Helper for copy:
8383
dea5311899c5 comments in copy methods
Claus Gittinger <cg@exept.de>
parents: 8377
diff changeset
  2387
     for each instance variable from anObject, send it aSymbol
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2388
     and store the result into the receiver,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2389
     which should be of the same class as the argument."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2390
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2391
    |myClass sz "{ Class: SmallInteger }" t |
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2392
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2393
    myClass := self class.
14532
f15633aab0fe class: Object
Stefan Vogel <sv@exept.de>
parents: 14527
diff changeset
  2394
f15633aab0fe class: Object
Stefan Vogel <sv@exept.de>
parents: 14527
diff changeset
  2395
    "process the named instance variables"
f15633aab0fe class: Object
Stefan Vogel <sv@exept.de>
parents: 14527
diff changeset
  2396
    sz := myClass instSize.
f15633aab0fe class: Object
Stefan Vogel <sv@exept.de>
parents: 14527
diff changeset
  2397
    1 to:sz do:[:i |
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2398
        t := anObject instVarAt:i.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2399
        aSymbol ~~ #yourself ifTrue:[
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2400
            t := t perform:aSymbol
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2401
        ].
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2402
        self instVarAt:i put:t
14532
f15633aab0fe class: Object
Stefan Vogel <sv@exept.de>
parents: 14527
diff changeset
  2403
    ].
f15633aab0fe class: Object
Stefan Vogel <sv@exept.de>
parents: 14527
diff changeset
  2404
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2405
    myClass isVariable ifTrue:[
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2406
        sz := self basicSize.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2407
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2408
        "process the indexed instance variables"
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2409
        1 to:sz do:[:i |
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2410
            t := anObject basicAt:i.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2411
            aSymbol ~~ #yourself ifTrue:[
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2412
                t := t perform:aSymbol.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2413
            ].
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2414
            self basicAt:i put:t.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2415
        ]
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2416
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2417
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2418
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2419
cloneInstanceVariablesFrom:aPrototype
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2420
    "Shallow copy variables from a prototype into myself.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2421
     This copies instVars by name - i.e. same-named variables are
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2422
     copied, others are not.
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  2423
     The variable slots are copied as available
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2424
     (i.e. the min of both indexed sizes is used)."
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  2425
19272
07c01cb9c96f #REFACTORING
Stefan Vogel <sv@exept.de>
parents: 18984
diff changeset
  2426
    |myClass prototypesClass myInfo prototypesInfo 
07c01cb9c96f #REFACTORING
Stefan Vogel <sv@exept.de>
parents: 18984
diff changeset
  2427
     sz "{ Class: SmallInteger }"|
14676
07174f47f540 class: Object
Claus Gittinger <cg@exept.de>
parents: 14661
diff changeset
  2428
07174f47f540 class: Object
Claus Gittinger <cg@exept.de>
parents: 14661
diff changeset
  2429
    myClass := self class.
07174f47f540 class: Object
Claus Gittinger <cg@exept.de>
parents: 14661
diff changeset
  2430
    prototypesClass := aPrototype class.
07174f47f540 class: Object
Claus Gittinger <cg@exept.de>
parents: 14661
diff changeset
  2431
    (myClass == prototypesClass
19272
07c01cb9c96f #REFACTORING
Stefan Vogel <sv@exept.de>
parents: 18984
diff changeset
  2432
     or:[myClass isSubclassOf:prototypesClass]) ifTrue:[
07c01cb9c96f #REFACTORING
Stefan Vogel <sv@exept.de>
parents: 18984
diff changeset
  2433
        "/ can do better, if my class is a subclass of the prototype's class
07c01cb9c96f #REFACTORING
Stefan Vogel <sv@exept.de>
parents: 18984
diff changeset
  2434
        sz := prototypesClass instSize.
07c01cb9c96f #REFACTORING
Stefan Vogel <sv@exept.de>
parents: 18984
diff changeset
  2435
        1 to: sz do:[:index |
07c01cb9c96f #REFACTORING
Stefan Vogel <sv@exept.de>
parents: 18984
diff changeset
  2436
            self instVarAt:index put:(aPrototype instVarAt:index)
07c01cb9c96f #REFACTORING
Stefan Vogel <sv@exept.de>
parents: 18984
diff changeset
  2437
        ]
14676
07174f47f540 class: Object
Claus Gittinger <cg@exept.de>
parents: 14661
diff changeset
  2438
    ] ifFalse:[
19272
07c01cb9c96f #REFACTORING
Stefan Vogel <sv@exept.de>
parents: 18984
diff changeset
  2439
        "/ map instvars by name
07c01cb9c96f #REFACTORING
Stefan Vogel <sv@exept.de>
parents: 18984
diff changeset
  2440
        myInfo := myClass instanceVariableOffsets.
07c01cb9c96f #REFACTORING
Stefan Vogel <sv@exept.de>
parents: 18984
diff changeset
  2441
        prototypesInfo := prototypesClass instanceVariableOffsets.
07c01cb9c96f #REFACTORING
Stefan Vogel <sv@exept.de>
parents: 18984
diff changeset
  2442
        myInfo keysAndValuesDo:[:name :index | |varIndexAssoc|
07c01cb9c96f #REFACTORING
Stefan Vogel <sv@exept.de>
parents: 18984
diff changeset
  2443
            varIndexAssoc := prototypesInfo at:name ifAbsent:[].
07c01cb9c96f #REFACTORING
Stefan Vogel <sv@exept.de>
parents: 18984
diff changeset
  2444
            varIndexAssoc notNil ifTrue:[
07c01cb9c96f #REFACTORING
Stefan Vogel <sv@exept.de>
parents: 18984
diff changeset
  2445
                self instVarAt:index put:(aPrototype instVarAt:(varIndexAssoc value))
07c01cb9c96f #REFACTORING
Stefan Vogel <sv@exept.de>
parents: 18984
diff changeset
  2446
            ]
07c01cb9c96f #REFACTORING
Stefan Vogel <sv@exept.de>
parents: 18984
diff changeset
  2447
        ]
14676
07174f47f540 class: Object
Claus Gittinger <cg@exept.de>
parents: 14661
diff changeset
  2448
    ].
07174f47f540 class: Object
Claus Gittinger <cg@exept.de>
parents: 14661
diff changeset
  2449
    myClass isVariable ifTrue:[
19272
07c01cb9c96f #REFACTORING
Stefan Vogel <sv@exept.de>
parents: 18984
diff changeset
  2450
        prototypesClass isVariable ifTrue:[
07c01cb9c96f #REFACTORING
Stefan Vogel <sv@exept.de>
parents: 18984
diff changeset
  2451
            sz := self basicSize min:aPrototype basicSize.
07c01cb9c96f #REFACTORING
Stefan Vogel <sv@exept.de>
parents: 18984
diff changeset
  2452
            1 to:sz do:[:index |
07c01cb9c96f #REFACTORING
Stefan Vogel <sv@exept.de>
parents: 18984
diff changeset
  2453
                self basicAt:index put:(aPrototype basicAt:index)
07c01cb9c96f #REFACTORING
Stefan Vogel <sv@exept.de>
parents: 18984
diff changeset
  2454
            ].
07c01cb9c96f #REFACTORING
Stefan Vogel <sv@exept.de>
parents: 18984
diff changeset
  2455
        ].
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2456
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2457
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2458
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2459
     Class withoutUpdatingChangesDo:[
19272
07c01cb9c96f #REFACTORING
Stefan Vogel <sv@exept.de>
parents: 18984
diff changeset
  2460
        |point3D|
07c01cb9c96f #REFACTORING
Stefan Vogel <sv@exept.de>
parents: 18984
diff changeset
  2461
07c01cb9c96f #REFACTORING
Stefan Vogel <sv@exept.de>
parents: 18984
diff changeset
  2462
        point3D := Point subclass:#Point3D
07c01cb9c96f #REFACTORING
Stefan Vogel <sv@exept.de>
parents: 18984
diff changeset
  2463
           instanceVariableNames:'z'
07c01cb9c96f #REFACTORING
Stefan Vogel <sv@exept.de>
parents: 18984
diff changeset
  2464
           classVariableNames:''
07c01cb9c96f #REFACTORING
Stefan Vogel <sv@exept.de>
parents: 18984
diff changeset
  2465
           poolDictionaries:''
07c01cb9c96f #REFACTORING
Stefan Vogel <sv@exept.de>
parents: 18984
diff changeset
  2466
           category:'testing'
07c01cb9c96f #REFACTORING
Stefan Vogel <sv@exept.de>
parents: 18984
diff changeset
  2467
           inEnvironment:nil.
07c01cb9c96f #REFACTORING
Stefan Vogel <sv@exept.de>
parents: 18984
diff changeset
  2468
         (point3D new cloneInstanceVariablesFrom:1@2) inspect.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2469
     ]
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2470
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2471
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2472
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2473
     Class withoutUpdatingChangesDo:[
19272
07c01cb9c96f #REFACTORING
Stefan Vogel <sv@exept.de>
parents: 18984
diff changeset
  2474
         Point variableSubclass:#Point3D_test
07c01cb9c96f #REFACTORING
Stefan Vogel <sv@exept.de>
parents: 18984
diff changeset
  2475
           instanceVariableNames:'z'
07c01cb9c96f #REFACTORING
Stefan Vogel <sv@exept.de>
parents: 18984
diff changeset
  2476
           classVariableNames:''
07c01cb9c96f #REFACTORING
Stefan Vogel <sv@exept.de>
parents: 18984
diff changeset
  2477
           poolDictionaries:''
07c01cb9c96f #REFACTORING
Stefan Vogel <sv@exept.de>
parents: 18984
diff changeset
  2478
           category:'testing'.
07c01cb9c96f #REFACTORING
Stefan Vogel <sv@exept.de>
parents: 18984
diff changeset
  2479
         (((Smalltalk at:#Point3D_test) new:2) cloneInstanceVariablesFrom:#(1 2 3)) inspect.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2480
     ]
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2481
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2482
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2483
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2484
     |someObject|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2485
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2486
     Class withoutUpdatingChangesDo:[
19272
07c01cb9c96f #REFACTORING
Stefan Vogel <sv@exept.de>
parents: 18984
diff changeset
  2487
         Object subclass:#TestClass1
07c01cb9c96f #REFACTORING
Stefan Vogel <sv@exept.de>
parents: 18984
diff changeset
  2488
           instanceVariableNames:'foo bar'
07c01cb9c96f #REFACTORING
Stefan Vogel <sv@exept.de>
parents: 18984
diff changeset
  2489
           classVariableNames:''
07c01cb9c96f #REFACTORING
Stefan Vogel <sv@exept.de>
parents: 18984
diff changeset
  2490
           poolDictionaries:''
07c01cb9c96f #REFACTORING
Stefan Vogel <sv@exept.de>
parents: 18984
diff changeset
  2491
           category:'testing'.
07c01cb9c96f #REFACTORING
Stefan Vogel <sv@exept.de>
parents: 18984
diff changeset
  2492
         someObject := TestClass1 new.
07c01cb9c96f #REFACTORING
Stefan Vogel <sv@exept.de>
parents: 18984
diff changeset
  2493
         someObject instVarAt:1 put:'foo'; instVarAt:2 put:'bar'.
07c01cb9c96f #REFACTORING
Stefan Vogel <sv@exept.de>
parents: 18984
diff changeset
  2494
         Object subclass:#TestClass2
07c01cb9c96f #REFACTORING
Stefan Vogel <sv@exept.de>
parents: 18984
diff changeset
  2495
           instanceVariableNames:'bar foo'
07c01cb9c96f #REFACTORING
Stefan Vogel <sv@exept.de>
parents: 18984
diff changeset
  2496
           classVariableNames:''
07c01cb9c96f #REFACTORING
Stefan Vogel <sv@exept.de>
parents: 18984
diff changeset
  2497
           poolDictionaries:''
07c01cb9c96f #REFACTORING
Stefan Vogel <sv@exept.de>
parents: 18984
diff changeset
  2498
           category:'testing'.
07c01cb9c96f #REFACTORING
Stefan Vogel <sv@exept.de>
parents: 18984
diff changeset
  2499
         (TestClass2 new cloneInstanceVariablesFrom:someObject) inspect.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2500
     ]
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2501
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2502
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2503
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2504
     |top b b1|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2505
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2506
     top := StandardSystemView new.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2507
     top extent:100@100.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2508
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2509
     b := Button in:top.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2510
     b label:'hello'.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2511
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2512
     b1 := ArrowButton new cloneInstanceVariablesFrom:b.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2513
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2514
     top open.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2515
     b1 inspect
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2516
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2517
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2518
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2519
copy
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2520
    "return a copy of the receiver - defaults to shallowcopy here.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2521
     Notice, that copy does not copy dependents."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2522
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2523
    ^ self shallowCopy postCopy
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2524
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2525
6146
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
  2526
copyToLevel:level
6962
eab0d4c42375 copyToLevel: example and comment
Claus Gittinger <cg@exept.de>
parents: 6961
diff changeset
  2527
    "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
  2528
     Notice:
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2529
         This method DOES NOT handle cycles/self-refs and does NOT preserve object identity;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2530
         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
  2531
14534
5c9bbb0cc2ba class: Object
Stefan Vogel <sv@exept.de>
parents: 14532
diff changeset
  2532
    |newObject newLevel class sz "{Class: SmallInteger}" newInst|
5c9bbb0cc2ba class: Object
Stefan Vogel <sv@exept.de>
parents: 14532
diff changeset
  2533
5c9bbb0cc2ba class: Object
Stefan Vogel <sv@exept.de>
parents: 14532
diff changeset
  2534
    newObject := self copy.
5c9bbb0cc2ba class: Object
Stefan Vogel <sv@exept.de>
parents: 14532
diff changeset
  2535
    newObject == self ifTrue: [^ self].   "copy of nil, true, false, ... is self"
5c9bbb0cc2ba class: Object
Stefan Vogel <sv@exept.de>
parents: 14532
diff changeset
  2536
    level == 1 ifTrue:[^ newObject].
5c9bbb0cc2ba class: Object
Stefan Vogel <sv@exept.de>
parents: 14532
diff changeset
  2537
    newLevel := level - 1.
5c9bbb0cc2ba class: Object
Stefan Vogel <sv@exept.de>
parents: 14532
diff changeset
  2538
5c9bbb0cc2ba class: Object
Stefan Vogel <sv@exept.de>
parents: 14532
diff changeset
  2539
    class := newObject class.
5c9bbb0cc2ba class: Object
Stefan Vogel <sv@exept.de>
parents: 14532
diff changeset
  2540
5c9bbb0cc2ba class: Object
Stefan Vogel <sv@exept.de>
parents: 14532
diff changeset
  2541
    "process the named instance variables"
5c9bbb0cc2ba class: Object
Stefan Vogel <sv@exept.de>
parents: 14532
diff changeset
  2542
    sz := class instSize.
5c9bbb0cc2ba class: Object
Stefan Vogel <sv@exept.de>
parents: 14532
diff changeset
  2543
    1 to:sz do:[:i |
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2544
        newInst := newObject instVarAt:i.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2545
        newInst notNil ifTrue:[
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2546
            newObject instVarAt:i put:(newInst copyToLevel:newLevel).
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2547
        ].
14534
5c9bbb0cc2ba class: Object
Stefan Vogel <sv@exept.de>
parents: 14532
diff changeset
  2548
    ].
5c9bbb0cc2ba class: Object
Stefan Vogel <sv@exept.de>
parents: 14532
diff changeset
  2549
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  2550
    class isVariable ifTrue:[
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2551
        sz := newObject basicSize.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2552
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2553
        "process the indexed instance variables"
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2554
        1 to:sz do:[:i |
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2555
            newInst := newObject basicAt:i.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2556
            newInst notNil ifTrue:[
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2557
                newObject basicAt:i put:(newInst copyToLevel:newLevel).
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2558
            ].
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2559
        ]
6962
eab0d4c42375 copyToLevel: example and comment
Claus Gittinger <cg@exept.de>
parents: 6961
diff changeset
  2560
    ].
eab0d4c42375 copyToLevel: example and comment
Claus Gittinger <cg@exept.de>
parents: 6961
diff changeset
  2561
    ^ newObject
eab0d4c42375 copyToLevel: example and comment
Claus Gittinger <cg@exept.de>
parents: 6961
diff changeset
  2562
eab0d4c42375 copyToLevel: example and comment
Claus Gittinger <cg@exept.de>
parents: 6961
diff changeset
  2563
    "
eab0d4c42375 copyToLevel: example and comment
Claus Gittinger <cg@exept.de>
parents: 6961
diff changeset
  2564
     |a b|
eab0d4c42375 copyToLevel: example and comment
Claus Gittinger <cg@exept.de>
parents: 6961
diff changeset
  2565
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  2566
     a := #(
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2567
            '1.1'
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2568
            '1.2'
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2569
            '1.3'
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2570
            (
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2571
                '1.41'
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2572
                '1.42'
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2573
                '1.43'
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2574
                    (
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2575
                        '1.441'
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2576
                        '1.442'
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2577
                        '1.443'
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2578
                        ( '1.4441' '1.4442' '1.4443' )
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2579
                        '1.445'
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2580
                    )
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2581
                '1.45'
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2582
            )
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2583
            '1.5'
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2584
           ).
6962
eab0d4c42375 copyToLevel: example and comment
Claus Gittinger <cg@exept.de>
parents: 6961
diff changeset
  2585
eab0d4c42375 copyToLevel: example and comment
Claus Gittinger <cg@exept.de>
parents: 6961
diff changeset
  2586
      b := a copyToLevel:1.
eab0d4c42375 copyToLevel: example and comment
Claus Gittinger <cg@exept.de>
parents: 6961
diff changeset
  2587
      self assert: ( (a at:1) == (b at:1) ).
eab0d4c42375 copyToLevel: example and comment
Claus Gittinger <cg@exept.de>
parents: 6961
diff changeset
  2588
      self assert: ( (a at:4) == (b at:4) ).
eab0d4c42375 copyToLevel: example and comment
Claus Gittinger <cg@exept.de>
parents: 6961
diff changeset
  2589
eab0d4c42375 copyToLevel: example and comment
Claus Gittinger <cg@exept.de>
parents: 6961
diff changeset
  2590
      b := a copyToLevel:2.
eab0d4c42375 copyToLevel: example and comment
Claus Gittinger <cg@exept.de>
parents: 6961
diff changeset
  2591
      self assert: ( (a at:1) ~~ (b at:1) ).
eab0d4c42375 copyToLevel: example and comment
Claus Gittinger <cg@exept.de>
parents: 6961
diff changeset
  2592
      self assert: ( (a at:4) ~~ (b at:4) ).
eab0d4c42375 copyToLevel: example and comment
Claus Gittinger <cg@exept.de>
parents: 6961
diff changeset
  2593
      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
  2594
      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
  2595
eab0d4c42375 copyToLevel: example and comment
Claus Gittinger <cg@exept.de>
parents: 6961
diff changeset
  2596
      b := a copyToLevel:3.
eab0d4c42375 copyToLevel: example and comment
Claus Gittinger <cg@exept.de>
parents: 6961
diff changeset
  2597
      self assert: ( (a at:1) ~~ (b at:1) ).
eab0d4c42375 copyToLevel: example and comment
Claus Gittinger <cg@exept.de>
parents: 6961
diff changeset
  2598
      self assert: ( (a at:4) ~~ (b at:4) ).
eab0d4c42375 copyToLevel: example and comment
Claus Gittinger <cg@exept.de>
parents: 6961
diff changeset
  2599
      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
  2600
      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
  2601
      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
  2602
      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
  2603
    "
6146
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
  2604
!
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
  2605
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2606
deepCopy
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2607
    "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
  2608
     This method DOES handle cycles/self-refs and preserves object identity;
19451
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  2609
     however the receiver's class is not copied (to avoid the 'total' copy).
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2610
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2611
     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
  2612
     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
  2613
     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
  2614
     no cycles are involved, you can use the old simpleDeepCopy,
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2615
     which avoids this overhead (but may run into trouble).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2616
     Notice, that deepCopy does not copy dependents."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2617
8383
dea5311899c5 comments in copy methods
Claus Gittinger <cg@exept.de>
parents: 8377
diff changeset
  2618
    ^ self deepCopyUsing:(IdentityDictionary new)
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2619
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2620
    "an example which is not handled by the old deepCopy:
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  2621
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2622
     |a|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2623
     a := Array new:3.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2624
     a at:3 put:a.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2625
     a deepCopy inspect
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2626
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2627
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2628
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2629
     |a|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2630
     a := Color black onDevice:Screen current.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2631
     a deepCopy inspect
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2632
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2633
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2634
    "Modified: 27.3.1996 / 16:31:20 / stefan"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2635
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2636
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2637
deepCopyError
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2638
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2639
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2640
    "raise a signal, that deepCopy is not allowed for this object"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2641
8330
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
  2642
    ^ DeepCopyError raise
5755
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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2645
deepCopyUsing:aDictionary
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  2646
    "a helper for deepCopy; return a copy of the object with
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  2647
     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
  2648
     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
  2649
     This method DOES handle cycles/self references."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2650
10941
f80dfc67dc51 deepCopy change
ab
parents: 10922
diff changeset
  2651
    ^ self deepCopyUsing:aDictionary postCopySelector:#postDeepCopyFrom:.
f80dfc67dc51 deepCopy change
ab
parents: 10922
diff changeset
  2652
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2653
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
     |a b c copyOfC|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2656
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2657
     a := Array with:'hello' with:'world' with:nil.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2658
     b := 99 @ 999.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2659
     a at:3 put:b.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2660
     c := Array with:a with:b with:a.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2661
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2662
     Transcript showCR: (c at:1) == (c at:3).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2663
     copyOfC := c deepCopy.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2664
     Transcript showCR: (copyOfC at:1) == (copyOfC at:3)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2665
    "
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
10954
b0d7bbc8673d deepCopyUsing:postCopySelector: in libbasic
sr
parents: 10941
diff changeset
  2668
deepCopyUsing:aDictionary postCopySelector:postCopySelector
11335
c061d08b766f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11314
diff changeset
  2669
    "a helper for deepCopy; return a copy of the object with
c061d08b766f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11314
diff changeset
  2670
     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
  2671
     use the value found there. The class of the receiver is not copied.
b0d7bbc8673d deepCopyUsing:postCopySelector: in libbasic
sr
parents: 10941
diff changeset
  2672
     This method DOES handle cycles/self references."
b0d7bbc8673d deepCopyUsing:postCopySelector: in libbasic
sr
parents: 10941
diff changeset
  2673
b0d7bbc8673d deepCopyUsing:postCopySelector: in libbasic
sr
parents: 10941
diff changeset
  2674
    |myClass aCopy
14527
b933e9f1e53d class: Object
Stefan Vogel <sv@exept.de>
parents: 14499
diff changeset
  2675
     basicSize "{ Class: SmallInteger }"
b933e9f1e53d class: Object
Stefan Vogel <sv@exept.de>
parents: 14499
diff changeset
  2676
     instSize  "{ Class: SmallInteger }"
10954
b0d7bbc8673d deepCopyUsing:postCopySelector: in libbasic
sr
parents: 10941
diff changeset
  2677
     iOrig iCopy|
b0d7bbc8673d deepCopyUsing:postCopySelector: in libbasic
sr
parents: 10941
diff changeset
  2678
b0d7bbc8673d deepCopyUsing:postCopySelector: in libbasic
sr
parents: 10941
diff changeset
  2679
    myClass := self class.
b0d7bbc8673d deepCopyUsing:postCopySelector: in libbasic
sr
parents: 10941
diff changeset
  2680
    myClass isVariable ifTrue:[
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2681
        basicSize := self basicSize.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2682
        aCopy := self speciesForCopy basicNew:basicSize.
10954
b0d7bbc8673d deepCopyUsing:postCopySelector: in libbasic
sr
parents: 10941
diff changeset
  2683
    ] ifFalse:[
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2684
        basicSize := 0.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2685
        aCopy := self speciesForCopy basicNew
10954
b0d7bbc8673d deepCopyUsing:postCopySelector: in libbasic
sr
parents: 10941
diff changeset
  2686
    ].
b0d7bbc8673d deepCopyUsing:postCopySelector: in libbasic
sr
parents: 10941
diff changeset
  2687
    aCopy setHashFrom:self.
b0d7bbc8673d deepCopyUsing:postCopySelector: in libbasic
sr
parents: 10941
diff changeset
  2688
    aDictionary at:self put:aCopy.
b0d7bbc8673d deepCopyUsing:postCopySelector: in libbasic
sr
parents: 10941
diff changeset
  2689
b0d7bbc8673d deepCopyUsing:postCopySelector: in libbasic
sr
parents: 10941
diff changeset
  2690
    "
14527
b933e9f1e53d class: Object
Stefan Vogel <sv@exept.de>
parents: 14499
diff changeset
  2691
     copy the instance variables
b933e9f1e53d class: Object
Stefan Vogel <sv@exept.de>
parents: 14499
diff changeset
  2692
    "
b933e9f1e53d class: Object
Stefan Vogel <sv@exept.de>
parents: 14499
diff changeset
  2693
    instSize := myClass instSize.
b933e9f1e53d class: Object
Stefan Vogel <sv@exept.de>
parents: 14499
diff changeset
  2694
    1 to:instSize do:[:i |
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2695
        (self skipInstvarIndexInDeepCopy:i) ifFalse:[
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2696
            iOrig := self instVarAt:i.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2697
            iOrig notNil ifTrue:[
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2698
                iCopy := aDictionary at:iOrig ifAbsent:nil.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2699
                iCopy isNil ifTrue:[
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2700
                    iCopy := iOrig deepCopyUsing:aDictionary postCopySelector:postCopySelector
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2701
                ].
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2702
                aCopy instVarAt:i put:iCopy
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2703
            ]
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2704
        ]
14527
b933e9f1e53d class: Object
Stefan Vogel <sv@exept.de>
parents: 14499
diff changeset
  2705
    ].
b933e9f1e53d class: Object
Stefan Vogel <sv@exept.de>
parents: 14499
diff changeset
  2706
b933e9f1e53d class: Object
Stefan Vogel <sv@exept.de>
parents: 14499
diff changeset
  2707
    "
10954
b0d7bbc8673d deepCopyUsing:postCopySelector: in libbasic
sr
parents: 10941
diff changeset
  2708
     copy indexed instvars - if any
b0d7bbc8673d deepCopyUsing:postCopySelector: in libbasic
sr
parents: 10941
diff changeset
  2709
    "
14527
b933e9f1e53d class: Object
Stefan Vogel <sv@exept.de>
parents: 14499
diff changeset
  2710
    basicSize ~~ 0 ifTrue:[
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2711
        myClass isBits ifTrue:[
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2712
            "block-copy indexed instvars"
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2713
            aCopy replaceFrom:1 to:basicSize with:self startingAt:1
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2714
        ] ifFalse:[
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2715
            "individual deep copy the indexed variables"
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2716
            1 to:basicSize do:[:i |
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2717
                iOrig := self basicAt:i.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2718
                iOrig notNil ifTrue:[
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2719
                    "/ used to be dict-includesKey-ifTrue[dict-at:],
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2720
                    "/ changed to use dict-at:ifAbsent:, to avoid double lookup in dictionary
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2721
                    iCopy := aDictionary at:iOrig ifAbsent:nil.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2722
                    iCopy isNil ifTrue:[
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2723
                        iCopy := iOrig deepCopyUsing:aDictionary postCopySelector:postCopySelector
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2724
                    ].
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2725
                    aCopy basicAt:i put:iCopy
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2726
                ]
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2727
            ]
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2728
        ]
10954
b0d7bbc8673d deepCopyUsing:postCopySelector: in libbasic
sr
parents: 10941
diff changeset
  2729
    ].
b0d7bbc8673d deepCopyUsing:postCopySelector: in libbasic
sr
parents: 10941
diff changeset
  2730
13515
2c1e968842cb changed: #deepCopyUsing:postCopySelector:
Claus Gittinger <cg@exept.de>
parents: 13500
diff changeset
  2731
    aCopy perform:postCopySelector withOptionalArgument:self and:aDictionary.
10954
b0d7bbc8673d deepCopyUsing:postCopySelector: in libbasic
sr
parents: 10941
diff changeset
  2732
    ^ aCopy
13515
2c1e968842cb changed: #deepCopyUsing:postCopySelector:
Claus Gittinger <cg@exept.de>
parents: 13500
diff changeset
  2733
2c1e968842cb changed: #deepCopyUsing:postCopySelector:
Claus Gittinger <cg@exept.de>
parents: 13500
diff changeset
  2734
    "Modified: / 21-07-2011 / 13:30:52 / cg"
10954
b0d7bbc8673d deepCopyUsing:postCopySelector: in libbasic
sr
parents: 10941
diff changeset
  2735
!
b0d7bbc8673d deepCopyUsing:postCopySelector: in libbasic
sr
parents: 10941
diff changeset
  2736
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2737
postCopy
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2738
    "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
  2739
     cleanup after copying, while ST/X passes the original in postCopyFrom:
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2740
     (see there)"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2741
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2742
    ^ self
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2743
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2744
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2745
postDeepCopy
8930
edd42af66c0a deepCopy should not invoke postCopy
Claus Gittinger <cg@exept.de>
parents: 8913
diff changeset
  2746
    "allows for cleanup after deep copying.
edd42af66c0a deepCopy should not invoke postCopy
Claus Gittinger <cg@exept.de>
parents: 8913
diff changeset
  2747
     To be redefined in subclasses."
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2748
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2749
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2750
postDeepCopyFrom:aSource
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2751
    "allows for cleanup after deep copying"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2752
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2753
    ^ self postDeepCopy
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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2756
setHashFrom:anObject
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  2757
    "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
  2758
     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
  2759
     Smalltalks, and may not be available in future ST/X versions.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2760
     DO NEVER use this for normal application code."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2761
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2762
%{  /* NOCONTEXT */
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2763
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2764
    REGISTER unsigned h;
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
    if (__isNonNilObject(self) && __isNonNilObject(anObject)) {
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2767
        h = __GET_HASH(anObject);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2768
        __SET_HASH(self, h);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2769
        RETURN (self);
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2770
    }
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2771
%}.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2772
    self primitiveFailed    "neither receiver not arg may be nil or SmallInteger"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2773
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2774
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2775
shallowCopy
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2776
    "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
  2777
     i.e. the copy shares referenced instvars with its original."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2778
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2779
%{  /* NOCONTEXT */
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2780
    int ninsts, spc;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2781
    int sz;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2782
    OBJ theCopy;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2783
    OBJ cls;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2784
    int flags;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2785
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2786
    cls = __qClass(self);
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2787
    flags = __intVal(__ClassInstPtr(cls)->c_flags);
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2788
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2789
    /*
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2790
     * bail out for special objects ..
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2791
     */
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2792
    if (((flags & ~ARRAYMASK) == 0)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2793
     && ((flags & ARRAYMASK) != WKPOINTERARRAY)) {
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2794
        sz = __qSize(self);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2795
        __PROTECT__(self);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2796
        __qNew(theCopy, sz);    /* OBJECT ALLOCATION */
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2797
        __UNPROTECT__(self);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2798
        if (theCopy) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2799
            cls = __qClass(self);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2800
            spc = __qSpace(theCopy);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2801
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2802
            theCopy->o_class = cls; __STORE_SPC(theCopy, cls, spc);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2803
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2804
            sz = sz - OHDR_SIZE;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2805
            if (sz) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2806
                char *src, *dst;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2807
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2808
                src = (char *)(__InstPtr(self)->i_instvars);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2809
                dst = (char *)(__InstPtr(theCopy)->i_instvars);
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2810
#ifdef bcopy4
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2811
                {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2812
                    /* care for odd-number of longs */
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2813
                    int nW = sz >> 2;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2814
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2815
                    if (sz & 3) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2816
                        nW++;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2817
                    }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2818
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2819
                    bcopy4(src, dst, nW);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2820
                }
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2821
#else
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2822
                bcopy(src, dst, sz);
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2823
#endif
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2824
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2825
                flags &= ARRAYMASK;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2826
                if (flags == POINTERARRAY) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2827
                    ninsts = __BYTES2OBJS__(sz);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2828
                } else {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2829
                    ninsts = __intVal(__ClassInstPtr(cls)->c_ninstvars);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2830
                }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2831
                if (ninsts) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2832
                    do {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2833
                        OBJ el;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2834
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2835
                        el = __InstPtr(theCopy)->i_instvars[ninsts-1];
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2836
                        __STORE_SPC(theCopy, el, spc);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2837
                    } while (--ninsts);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2838
                }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2839
            }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2840
            RETURN (theCopy);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2841
        }
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2842
    }
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2843
%}.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2844
    "/ fallBack for special objects & memoryAllocation failure case
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2845
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2846
    ^ self slowShallowCopy
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2847
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2848
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2849
simpleDeepCopy
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2850
    "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
  2851
     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
  2852
     slightly faster copy in situations where it is known that
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2853
     no recursive references occur (LargeIntegers for example).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2854
     NOTICE: you will run into trouble, when trying this with recursive
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2855
     objects (usually recursionInterrupt or memory-alert).
8383
dea5311899c5 comments in copy methods
Claus Gittinger <cg@exept.de>
parents: 8377
diff changeset
  2856
     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
  2857
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2858
    |myClass aCopy|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2859
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2860
    (myClass := self class) isVariable ifTrue:[
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2861
        aCopy := myClass basicNew:(self basicSize).
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2862
    ] ifFalse:[
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2863
        aCopy := myClass basicNew
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2864
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2865
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2866
    "copy the instance variables"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2867
    aCopy cloneFrom:self performing:#simpleDeepCopy.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2868
    ^ aCopy
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2869
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2870
    "a bad example (but ST/X should survive ...)"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2871
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2872
     |a|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2873
     a := Array new:3.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2874
     a at:3 put:a.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2875
     a simpleDeepCopy
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2876
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2877
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2878
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2879
skipInstvarIndexInDeepCopy:index
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2880
    "a helper for deepCopy; only indices for which this method returns
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2881
     false are copied in a deep copy.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2882
     The default is false here - which means that everything is copied.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2883
     Can be redefined in subclasses for partial copies"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2884
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2885
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2886
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2887
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2888
slowShallowCopy
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2889
    "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
  2890
     i.e. the copy shares referenced instvars with its original.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2891
     This method is only invoked as a fallback from #shallowCopy."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2892
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2893
    |myClass aCopy|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2894
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2895
    (myClass := self class) isVariable ifTrue:[
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2896
        aCopy := myClass basicNew:(self basicSize).
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2897
    ] ifFalse:[
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2898
        aCopy := myClass basicNew
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2899
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2900
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2901
    "copy the instance variables"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2902
    aCopy cloneFrom:self performing:#yourself.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2903
    ^ aCopy
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2904
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2905
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2906
!Object methodsFor:'debugging'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2907
7621
42fb582ea36b allow for blocks in assert
Claus Gittinger <cg@exept.de>
parents: 7600
diff changeset
  2908
assert:aBooleanOrBlock
13800
2f04da6f127e comment/format in: #assert:
Stefan Vogel <sv@exept.de>
parents: 13710
diff changeset
  2909
    "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
  2910
11662
08309a406658 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11634
diff changeset
  2911
    "{ Pragma: +optSpace }"
08309a406658 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11634
diff changeset
  2912
11021
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  2913
    <resource: #skipInDebuggersWalkBack>
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  2914
8876
dc094269db8e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8872
diff changeset
  2915
    aBooleanOrBlock == true ifTrue:[^ self].
17437
9662511375cf class: Object
Claus Gittinger <cg@exept.de>
parents: 17429
diff changeset
  2916
    (Smalltalk ignoreAssertions) ifTrue:[^ self].
11044
fa13d9423e71 allow for encounteredBreakPoints to be monitored
Claus Gittinger <cg@exept.de>
parents: 11025
diff changeset
  2917
8876
dc094269db8e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8872
diff changeset
  2918
    "/ could still be a block or false.
11662
08309a406658 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11634
diff changeset
  2919
    (aBooleanOrBlock value) ifFalse:[
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2920
        AssertionFailedError
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2921
            raiseRequestWith:self
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2922
            errorString:('Assertion failed in ',
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2923
                         thisContext methodHome sender printString,
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2924
                         '[', thisContext  methodHome sender lineNumber printString,']')
11662
08309a406658 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11634
diff changeset
  2925
    ].
08309a406658 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11634
diff changeset
  2926
08309a406658 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11634
diff changeset
  2927
    "
08309a406658 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11634
diff changeset
  2928
     self assert:false
08309a406658 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11634
diff changeset
  2929
    "
13039
43313704ee61 changed: #assert:
Claus Gittinger <cg@exept.de>
parents: 12997
diff changeset
  2930
43313704ee61 changed: #assert:
Claus Gittinger <cg@exept.de>
parents: 12997
diff changeset
  2931
    "Modified: / 20-08-2010 / 17:13:06 / cg"
7621
42fb582ea36b allow for blocks in assert
Claus Gittinger <cg@exept.de>
parents: 7600
diff changeset
  2932
!
42fb582ea36b allow for blocks in assert
Claus Gittinger <cg@exept.de>
parents: 7600
diff changeset
  2933
19287
7e945c7dc124 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19272
diff changeset
  2934
assert:aBooleanOrBlock description:messageIfFailing
11044
fa13d9423e71 allow for encounteredBreakPoints to be monitored
Claus Gittinger <cg@exept.de>
parents: 11025
diff changeset
  2935
    "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
  2936
096ca5ceb662 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6954
diff changeset
  2937
    "{ Pragma: +optSpace }"
096ca5ceb662 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6954
diff changeset
  2938
11021
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  2939
    <resource: #skipInDebuggersWalkBack>
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  2940
11141
b96ed3ac5825 assertions can be globally disabled
Claus Gittinger <cg@exept.de>
parents: 11132
diff changeset
  2941
    aBooleanOrBlock == true ifTrue:[^ self].
17437
9662511375cf class: Object
Claus Gittinger <cg@exept.de>
parents: 17429
diff changeset
  2942
    (Smalltalk ignoreAssertions) ifTrue:[^ self].
9662511375cf class: Object
Claus Gittinger <cg@exept.de>
parents: 17429
diff changeset
  2943
9662511375cf class: Object
Claus Gittinger <cg@exept.de>
parents: 17429
diff changeset
  2944
    "/ could still be a block or false.
7621
42fb582ea36b allow for blocks in assert
Claus Gittinger <cg@exept.de>
parents: 7600
diff changeset
  2945
    (aBooleanOrBlock value) ifFalse:[
19287
7e945c7dc124 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19272
diff changeset
  2946
        AssertionFailedError
7e945c7dc124 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19272
diff changeset
  2947
            raiseRequestWith:self
7e945c7dc124 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19272
diff changeset
  2948
            errorString:(messageIfFailing, ' {',thisContext methodHome sender "methodHome" printString,' }')
7e945c7dc124 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19272
diff changeset
  2949
    ].
7e945c7dc124 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19272
diff changeset
  2950
7e945c7dc124 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19272
diff changeset
  2951
    "
7e945c7dc124 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19272
diff changeset
  2952
     self assert:false description:'xxx'
7e945c7dc124 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19272
diff changeset
  2953
    "
7e945c7dc124 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19272
diff changeset
  2954
7e945c7dc124 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19272
diff changeset
  2955
    "Modified (comment): / 06-03-2012 / 11:26:48 / cg"
7e945c7dc124 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19272
diff changeset
  2956
!
7e945c7dc124 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19272
diff changeset
  2957
7e945c7dc124 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19272
diff changeset
  2958
assert:aBooleanOrBlock message:messageIfFailing
7e945c7dc124 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19272
diff changeset
  2959
    "fail, if the argument does not evaluate to true and report an error"
7e945c7dc124 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19272
diff changeset
  2960
7e945c7dc124 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19272
diff changeset
  2961
    "{ Pragma: +optSpace }"
7e945c7dc124 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19272
diff changeset
  2962
7e945c7dc124 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19272
diff changeset
  2963
    <resource: #skipInDebuggersWalkBack>
7e945c7dc124 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19272
diff changeset
  2964
7e945c7dc124 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19272
diff changeset
  2965
    ^ self assert: aBooleanOrBlock description: messageIfFailing
11662
08309a406658 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11634
diff changeset
  2966
08309a406658 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11634
diff changeset
  2967
    "
08309a406658 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11634
diff changeset
  2968
     self assert:false message:'xxx'
10651
b205dbfea7e5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10576
diff changeset
  2969
    "
14046
541f46216cb4 added: #disableAllBreakPoints
Claus Gittinger <cg@exept.de>
parents: 13990
diff changeset
  2970
541f46216cb4 added: #disableAllBreakPoints
Claus Gittinger <cg@exept.de>
parents: 13990
diff changeset
  2971
    "Modified (comment): / 06-03-2012 / 11:26:48 / cg"
6961
096ca5ceb662 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6954
diff changeset
  2972
!
096ca5ceb662 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6954
diff changeset
  2973
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2974
basicInspect
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2975
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2976
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2977
    "launch an inspector on the receiver.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2978
     this method should NOT be redefined in subclasses."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2979
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2980
    Inspector isNil ifTrue:[
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2981
        "
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2982
         for systems without GUI
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2983
        "
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2984
        self warn:'No Inspector defined (Inspector is nil).'
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2985
    ] ifFalse:[
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  2986
        Inspector openOn:self
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2987
    ]
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2988
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2989
    "Modified: 18.5.1996 / 15:43:25 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2990
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2991
11025
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  2992
breakPoint:someKey
6954
c3408e945eb5 oops - breakpoint lost
Claus Gittinger <cg@exept.de>
parents: 6950
diff changeset
  2993
    "{ Pragma: +optSpace }"
c3408e945eb5 oops - breakpoint lost
Claus Gittinger <cg@exept.de>
parents: 6950
diff changeset
  2994
c3408e945eb5 oops - breakpoint lost
Claus Gittinger <cg@exept.de>
parents: 6950
diff changeset
  2995
    "Like halt, but disabled by default.
c3408e945eb5 oops - breakpoint lost
Claus Gittinger <cg@exept.de>
parents: 6950
diff changeset
  2996
     Can be easily enabled.
c3408e945eb5 oops - breakpoint lost
Claus Gittinger <cg@exept.de>
parents: 6950
diff changeset
  2997
     Can be filtered on the arguments value (typically: a symbol).
c3408e945eb5 oops - breakpoint lost
Claus Gittinger <cg@exept.de>
parents: 6950
diff changeset
  2998
     Code with breakpoints may be even checked into the source repository"
c3408e945eb5 oops - breakpoint lost
Claus Gittinger <cg@exept.de>
parents: 6950
diff changeset
  2999
c3408e945eb5 oops - breakpoint lost
Claus Gittinger <cg@exept.de>
parents: 6950
diff changeset
  3000
    "Example:   nil breakPoint:#stefan"
c3408e945eb5 oops - breakpoint lost
Claus Gittinger <cg@exept.de>
parents: 6950
diff changeset
  3001
11025
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3002
    <resource: #skipInDebuggersWalkBack>
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3003
11048
feed33f1f796 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11045
diff changeset
  3004
    "/ dont send #breakPoint:info: here - ask cg why.
feed33f1f796 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11045
diff changeset
  3005
    (self isBreakPointEnabled:someKey) ifTrue:[
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3006
        ^ HaltSignal
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3007
            raiseRequestWith:someKey
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3008
            errorString:('Breakpoint encountered: %1' bindWith:someKey)
11048
feed33f1f796 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11045
diff changeset
  3009
    ].
11025
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3010
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3011
    "
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3012
     nil breakPoint:#stefan
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3013
     nil breakPoint:#stefan info:'Hello'
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3014
     Smalltalk enableBreakPoint:#stefan.
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3015
     Smalltalk disableBreakPoint:#stefan.
11048
feed33f1f796 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11045
diff changeset
  3016
feed33f1f796 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11045
diff changeset
  3017
     EncounteredBreakPoints.
feed33f1f796 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11045
diff changeset
  3018
     Smalltalk enableBreakPoint:#cg.
feed33f1f796 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11045
diff changeset
  3019
     Smalltalk disableBreakPoint:#cg.
11025
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3020
    "
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3021
!
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3022
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3023
breakPoint:someKey info:infoString
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3024
    "{ Pragma: +optSpace }"
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3025
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3026
    "Like halt, but disabled by default.
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3027
     Can be easily enabled.
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3028
     Can be filtered on the arguments value (typically: a symbol).
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3029
     Code with breakpoints may be even checked into the source repository"
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3030
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3031
    "Example:   nil breakPoint:#stefan"
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3032
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3033
    <resource: #skipInDebuggersWalkBack>
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3034
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3035
    (self isBreakPointEnabled:someKey) ifTrue:[
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3036
        ^ HaltSignal
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3037
            raiseRequestWith:someKey
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3038
            errorString:(infoString bindWith:someKey)
11025
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3039
    ].
6954
c3408e945eb5 oops - breakpoint lost
Claus Gittinger <cg@exept.de>
parents: 6950
diff changeset
  3040
!
c3408e945eb5 oops - breakpoint lost
Claus Gittinger <cg@exept.de>
parents: 6950
diff changeset
  3041
11244
7ecd4a866064 debuggingCodeFor:is:
Claus Gittinger <cg@exept.de>
parents: 11236
diff changeset
  3042
debuggingCodeFor:someKey is:aBlock
7ecd4a866064 debuggingCodeFor:is:
Claus Gittinger <cg@exept.de>
parents: 11236
diff changeset
  3043
    "{ Pragma: +optSpace }"
7ecd4a866064 debuggingCodeFor:is:
Claus Gittinger <cg@exept.de>
parents: 11236
diff changeset
  3044
7ecd4a866064 debuggingCodeFor:is:
Claus Gittinger <cg@exept.de>
parents: 11236
diff changeset
  3045
    "aBlock is evaluated if breakPoints for somekey are enabled.
7ecd4a866064 debuggingCodeFor:is:
Claus Gittinger <cg@exept.de>
parents: 11236
diff changeset
  3046
     Allows for debugging code to be enabled/disabled via the breakpoint browser.
7ecd4a866064 debuggingCodeFor:is:
Claus Gittinger <cg@exept.de>
parents: 11236
diff changeset
  3047
     Can be easily enabled.
7ecd4a866064 debuggingCodeFor:is:
Claus Gittinger <cg@exept.de>
parents: 11236
diff changeset
  3048
     Can be filtered on the arguments value (typically: a symbol).
7ecd4a866064 debuggingCodeFor:is:
Claus Gittinger <cg@exept.de>
parents: 11236
diff changeset
  3049
     Code with breakpoints may be even checked into the source repository"
7ecd4a866064 debuggingCodeFor:is:
Claus Gittinger <cg@exept.de>
parents: 11236
diff changeset
  3050
7ecd4a866064 debuggingCodeFor:is:
Claus Gittinger <cg@exept.de>
parents: 11236
diff changeset
  3051
    "Example:   nil debuggingCodeFor:#cg is:[ self halt ]"
7ecd4a866064 debuggingCodeFor:is:
Claus Gittinger <cg@exept.de>
parents: 11236
diff changeset
  3052
7ecd4a866064 debuggingCodeFor:is:
Claus Gittinger <cg@exept.de>
parents: 11236
diff changeset
  3053
    <resource: #skipInDebuggersWalkBack>
7ecd4a866064 debuggingCodeFor:is:
Claus Gittinger <cg@exept.de>
parents: 11236
diff changeset
  3054
7ecd4a866064 debuggingCodeFor:is:
Claus Gittinger <cg@exept.de>
parents: 11236
diff changeset
  3055
    (self isBreakPointEnabled:someKey) ifTrue:[
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3056
        aBlock value
11244
7ecd4a866064 debuggingCodeFor:is:
Claus Gittinger <cg@exept.de>
parents: 11236
diff changeset
  3057
    ].
7ecd4a866064 debuggingCodeFor:is:
Claus Gittinger <cg@exept.de>
parents: 11236
diff changeset
  3058
7ecd4a866064 debuggingCodeFor:is:
Claus Gittinger <cg@exept.de>
parents: 11236
diff changeset
  3059
    "
7ecd4a866064 debuggingCodeFor:is:
Claus Gittinger <cg@exept.de>
parents: 11236
diff changeset
  3060
     Smalltalk disableBreakPoint:#cg.
12340
e9ea989ffe01 comment/format in: #debuggingCodeFor:is:
Claus Gittinger <cg@exept.de>
parents: 12328
diff changeset
  3061
     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
  3062
     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
  3063
     Smalltalk enableBreakPoint:#cg.
12340
e9ea989ffe01 comment/format in: #debuggingCodeFor:is:
Claus Gittinger <cg@exept.de>
parents: 12328
diff changeset
  3064
     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
  3065
     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
  3066
     Smalltalk disableBreakPoint:#cg.
7ecd4a866064 debuggingCodeFor:is:
Claus Gittinger <cg@exept.de>
parents: 11236
diff changeset
  3067
7ecd4a866064 debuggingCodeFor:is:
Claus Gittinger <cg@exept.de>
parents: 11236
diff changeset
  3068
    "
7ecd4a866064 debuggingCodeFor:is:
Claus Gittinger <cg@exept.de>
parents: 11236
diff changeset
  3069
!
7ecd4a866064 debuggingCodeFor:is:
Claus Gittinger <cg@exept.de>
parents: 11236
diff changeset
  3070
14046
541f46216cb4 added: #disableAllBreakPoints
Claus Gittinger <cg@exept.de>
parents: 13990
diff changeset
  3071
disableAllBreakPoints
541f46216cb4 added: #disableAllBreakPoints
Claus Gittinger <cg@exept.de>
parents: 13990
diff changeset
  3072
    "disable all parametrized breakPoints (with any key as parameter)"
541f46216cb4 added: #disableAllBreakPoints
Claus Gittinger <cg@exept.de>
parents: 13990
diff changeset
  3073
541f46216cb4 added: #disableAllBreakPoints
Claus Gittinger <cg@exept.de>
parents: 13990
diff changeset
  3074
    EnabledBreakPoints := nil
541f46216cb4 added: #disableAllBreakPoints
Claus Gittinger <cg@exept.de>
parents: 13990
diff changeset
  3075
541f46216cb4 added: #disableAllBreakPoints
Claus Gittinger <cg@exept.de>
parents: 13990
diff changeset
  3076
    "
541f46216cb4 added: #disableAllBreakPoints
Claus Gittinger <cg@exept.de>
parents: 13990
diff changeset
  3077
     nil enableBreakPoint:#cg.
541f46216cb4 added: #disableAllBreakPoints
Claus Gittinger <cg@exept.de>
parents: 13990
diff changeset
  3078
     nil breakPoint:#cg.
541f46216cb4 added: #disableAllBreakPoints
Claus Gittinger <cg@exept.de>
parents: 13990
diff changeset
  3079
     nil disableAllBreakPoints.
541f46216cb4 added: #disableAllBreakPoints
Claus Gittinger <cg@exept.de>
parents: 13990
diff changeset
  3080
     nil breakPoint:#cg.
541f46216cb4 added: #disableAllBreakPoints
Claus Gittinger <cg@exept.de>
parents: 13990
diff changeset
  3081
    "
541f46216cb4 added: #disableAllBreakPoints
Claus Gittinger <cg@exept.de>
parents: 13990
diff changeset
  3082
541f46216cb4 added: #disableAllBreakPoints
Claus Gittinger <cg@exept.de>
parents: 13990
diff changeset
  3083
    "Created: / 06-03-2012 / 15:32:28 / cg"
541f46216cb4 added: #disableAllBreakPoints
Claus Gittinger <cg@exept.de>
parents: 13990
diff changeset
  3084
!
541f46216cb4 added: #disableAllBreakPoints
Claus Gittinger <cg@exept.de>
parents: 13990
diff changeset
  3085
11025
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3086
disableBreakPoint:someKey
14046
541f46216cb4 added: #disableAllBreakPoints
Claus Gittinger <cg@exept.de>
parents: 13990
diff changeset
  3087
    "disable parametrized breakPoints with someKey as parameter"
11025
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3088
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3089
    "{ Pragma: +optSpace }"
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3090
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3091
    EnabledBreakPoints notNil ifTrue:[
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3092
        EnabledBreakPoints remove:someKey ifAbsent:[].
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3093
        EnabledBreakPoints := EnabledBreakPoints asNilIfEmpty.
11025
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3094
    ].
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3095
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3096
    "
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3097
     nil enableBreakPoint:#cg.
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3098
     nil breakPoint:#cg.
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3099
     nil disableBreakPoint:#cg
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3100
     nil breakPoint:#cg.
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3101
    "
14046
541f46216cb4 added: #disableAllBreakPoints
Claus Gittinger <cg@exept.de>
parents: 13990
diff changeset
  3102
541f46216cb4 added: #disableAllBreakPoints
Claus Gittinger <cg@exept.de>
parents: 13990
diff changeset
  3103
    "Modified (comment): / 06-03-2012 / 15:31:51 / cg"
11025
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3104
!
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3105
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3106
enableBreakPoint:someKey
14046
541f46216cb4 added: #disableAllBreakPoints
Claus Gittinger <cg@exept.de>
parents: 13990
diff changeset
  3107
    "enable parametrized breakPoints with someKey as parameter"
11025
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3108
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3109
    "{ Pragma: +optSpace }"
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3110
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3111
    EnabledBreakPoints isNil ifTrue:[
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3112
        EnabledBreakPoints := Set new.
11025
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3113
    ].
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3114
    EnabledBreakPoints add:someKey.
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3115
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3116
    "
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3117
     nil enableBreakPoint:#cg.
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3118
     nil breakPoint:#cg.
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3119
     nil disableBreakPoint:#cg
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3120
     nil breakPoint:#cg.
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3121
    "
14046
541f46216cb4 added: #disableAllBreakPoints
Claus Gittinger <cg@exept.de>
parents: 13990
diff changeset
  3122
541f46216cb4 added: #disableAllBreakPoints
Claus Gittinger <cg@exept.de>
parents: 13990
diff changeset
  3123
    "Modified (comment): / 06-03-2012 / 15:31:47 / cg"
11025
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3124
!
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3125
11048
feed33f1f796 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11045
diff changeset
  3126
halt
feed33f1f796 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11045
diff changeset
  3127
    "{ Pragma: +optSpace }"
feed33f1f796 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11045
diff changeset
  3128
feed33f1f796 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11045
diff changeset
  3129
    "enter debugger with halt-message.
feed33f1f796 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11045
diff changeset
  3130
     The error is reported by raising the HaltSignal exception."
feed33f1f796 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11045
diff changeset
  3131
feed33f1f796 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11045
diff changeset
  3132
    <resource: #skipInDebuggersWalkBack>
feed33f1f796 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11045
diff changeset
  3133
13136
e7d331537665 changed:
Claus Gittinger <cg@exept.de>
parents: 13099
diff changeset
  3134
    Smalltalk ignoreHalt ifTrue:[^ self].
14830
ac68533e9c43 class: Object
Claus Gittinger <cg@exept.de>
parents: 14778
diff changeset
  3135
    "/ don't send #halt: here - ask cg why.
14974
2f05d233c309 class: Object
Stefan Vogel <sv@exept.de>
parents: 14965
diff changeset
  3136
    HaltInterrupt raiseRequestWith:#halt.
2f05d233c309 class: Object
Stefan Vogel <sv@exept.de>
parents: 14965
diff changeset
  3137
    ^ self
2f05d233c309 class: Object
Stefan Vogel <sv@exept.de>
parents: 14965
diff changeset
  3138
2f05d233c309 class: Object
Stefan Vogel <sv@exept.de>
parents: 14965
diff changeset
  3139
    "
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3140
        (3 halt * 5)
14974
2f05d233c309 class: Object
Stefan Vogel <sv@exept.de>
parents: 14965
diff changeset
  3141
    "
11048
feed33f1f796 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11045
diff changeset
  3142
13136
e7d331537665 changed:
Claus Gittinger <cg@exept.de>
parents: 13099
diff changeset
  3143
    "Modified: / 02-08-1999 / 17:00:29 / stefan"
e7d331537665 changed:
Claus Gittinger <cg@exept.de>
parents: 13099
diff changeset
  3144
    "Modified: / 18-11-2010 / 11:21:51 / cg"
11048
feed33f1f796 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11045
diff changeset
  3145
!
feed33f1f796 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11045
diff changeset
  3146
feed33f1f796 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11045
diff changeset
  3147
halt:aString
feed33f1f796 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11045
diff changeset
  3148
    "{ Pragma: +optSpace }"
feed33f1f796 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11045
diff changeset
  3149
feed33f1f796 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11045
diff changeset
  3150
    "enter debugger with halt-message.
feed33f1f796 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11045
diff changeset
  3151
     The error is reported by raising the HaltSignal exception."
feed33f1f796 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11045
diff changeset
  3152
feed33f1f796 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11045
diff changeset
  3153
    <resource: #skipInDebuggersWalkBack>
feed33f1f796 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11045
diff changeset
  3154
13136
e7d331537665 changed:
Claus Gittinger <cg@exept.de>
parents: 13099
diff changeset
  3155
    Smalltalk ignoreHalt ifTrue:[^ self].
14974
2f05d233c309 class: Object
Stefan Vogel <sv@exept.de>
parents: 14965
diff changeset
  3156
    HaltInterrupt raiseRequestWith:#halt: errorString:aString.
2f05d233c309 class: Object
Stefan Vogel <sv@exept.de>
parents: 14965
diff changeset
  3157
    ^ self
11048
feed33f1f796 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11045
diff changeset
  3158
13136
e7d331537665 changed:
Claus Gittinger <cg@exept.de>
parents: 13099
diff changeset
  3159
    "Modified: / 18-11-2010 / 11:22:16 / cg"
11048
feed33f1f796 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11045
diff changeset
  3160
!
feed33f1f796 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11045
diff changeset
  3161
11025
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3162
isBreakPointEnabled:someKey
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3163
    "{ Pragma: +optSpace }"
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3164
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3165
    "controls which breakpoints to be enabled."
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3166
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3167
"/    something = OperatingSystem getLoginName ifTrue:[^ true].
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3168
"/    something = 'testThis' ifTrue:[^ true].
11044
fa13d9423e71 allow for encounteredBreakPoints to be monitored
Claus Gittinger <cg@exept.de>
parents: 11025
diff changeset
  3169
    EncounteredBreakPoints notNil ifTrue:[
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3170
        EncounteredBreakPoints add:someKey
11335
c061d08b766f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11314
diff changeset
  3171
    ].
c061d08b766f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11314
diff changeset
  3172
c061d08b766f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11314
diff changeset
  3173
    ^ (EnabledBreakPoints notNil and:[ EnabledBreakPoints includes:someKey ])
11025
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3174
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3175
    "
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3176
     nil enableBreakPoint:#cg.
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3177
     nil breakPoint:#cg.
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3178
     nil disableBreakPoint:#cg
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3179
     nil breakPoint:#cg.
11045
85315d8893e4 allow for encounteredBreakPoints to be monitored
Claus Gittinger <cg@exept.de>
parents: 11044
diff changeset
  3180
85315d8893e4 allow for encounteredBreakPoints to be monitored
Claus Gittinger <cg@exept.de>
parents: 11044
diff changeset
  3181
     EncounteredBreakPoints := Set new.
11025
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3182
    "
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3183
!
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3184
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3185
mustBeBoolean
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3186
    "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
  3187
     in an if* or while* message.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3188
     Caveat: for now, this is only sent by the interpreter;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3189
     both the JIT and the stc compiler treat it as undefined."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3190
11021
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  3191
    <resource: #skipInDebuggersWalkBack>
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  3192
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3193
    self error:'Non boolean receiver - proceed for truth' mayProceed:true.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3194
    ^ true
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3195
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3196
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3197
mustBeKindOf:aClass
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  3198
    "for compatibility & debugging support:
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3199
     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
  3200
     Notice:
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3201
        it is VERY questionable, if it makes sense to add manual
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3202
        type checks to a dynamically typed language like smalltalk.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3203
        It will, at least, slow down performance,
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3204
        make your code less reusable and clutter your code with stupid sends
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3205
        of this selector. Also, read the comment in isKindOf:, regarding the
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3206
        use of isXXX check methods.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3207
     You see: The author does not like this at all ..."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3208
11021
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  3209
    <resource: #skipInDebuggersWalkBack>
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  3210
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3211
    (self isKindOf:aClass) ifFalse:[
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3212
        self error:'argument is not of expected type'
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3213
    ]
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3214
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3215
6950
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3216
obsoleteFeatureWarning
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3217
    "{ Pragma: +optSpace }"
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3218
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3219
    "in methods which are going to be changed, a send to
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3220
     this method is used to tell programmers that some feature/semantics is
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3221
     used which is going to be changed in later ST/X versions.
6963
711b3bf3b38a comments
Claus Gittinger <cg@exept.de>
parents: 6962
diff changeset
  3222
     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
  3223
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3224
    self obsoleteFeatureWarning:nil from:thisContext sender
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3225
!
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3226
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3227
obsoleteFeatureWarning:message
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3228
    "{ Pragma: +optSpace }"
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3229
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3230
    "in methods which are going to be changed, a send to
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3231
     this method is used to tell programmers that some feature/semantics is
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3232
     used which is going to be changed in later ST/X versions.
6963
711b3bf3b38a comments
Claus Gittinger <cg@exept.de>
parents: 6962
diff changeset
  3233
     Hopefully, this warning message is annoying enough for you to change the code... ;-).
711b3bf3b38a comments
Claus Gittinger <cg@exept.de>
parents: 6962
diff changeset
  3234
     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
  3235
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3236
    self obsoleteFeatureWarning:message from:thisContext sender
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3237
!
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3238
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3239
obsoleteFeatureWarning:message from:aContext
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3240
    "{ Pragma: +optSpace }"
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3241
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3242
    "in methods which are going to be changed, a send to
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3243
     this method is used to tell programmers that some feature/semantics is
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3244
     used which is going to be changed in later ST/X versions.
6963
711b3bf3b38a comments
Claus Gittinger <cg@exept.de>
parents: 6962
diff changeset
  3245
     Hopefully, this warning message is annoying enough for you to change the code... ;-).
711b3bf3b38a comments
Claus Gittinger <cg@exept.de>
parents: 6962
diff changeset
  3246
     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
  3247
11527
d8f1c75ee4d2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11401
diff changeset
  3248
    |spec sender|
6950
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3249
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3250
    spec := aContext methodPrintString.
11527
d8f1c75ee4d2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11401
diff changeset
  3251
    sender := aContext sender.
d8f1c75ee4d2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11401
diff changeset
  3252
6950
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3253
    ('WARNING: the ''' , spec , ''' semantics will be changed.') infoPrintCR.
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3254
    ('         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
  3255
    ('         called from ' , sender printString) infoPrintCR.
d8f1c75ee4d2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11401
diff changeset
  3256
    ((sender selector ? '') startsWith:'perform:') ifTrue:[
d8f1c75ee4d2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11401
diff changeset
  3257
    ('         called from ' , sender sender printString) infoPrintCR.
7204
e968d9923408 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 7202
diff changeset
  3258
    ].
6950
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3259
    message notNil ifTrue:[
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3260
        '------>  ' infoPrint. message infoPrintCR
6950
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3261
    ]
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3262
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3263
    "
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3264
     Object obsoleteFeatureWarning:'foo' from:thisContext sender sender
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3265
    "
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3266
!
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3267
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3268
obsoleteMethodWarning
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3269
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3270
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3271
    "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
  3272
     this method is used to tell programmers that a method is
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3273
     used which is going to be removed in later ST/X versions.
6963
711b3bf3b38a comments
Claus Gittinger <cg@exept.de>
parents: 6962
diff changeset
  3274
     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
  3275
     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
  3276
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3277
    self obsoleteMethodWarning:nil from:thisContext sender
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
obsoleteMethodWarning:message
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3281
    "{ Pragma: +optSpace }"
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
    "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
  3284
     this method is used to tell programmers that a method is
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3285
     used which is going to be removed in later ST/X versions.
6963
711b3bf3b38a comments
Claus Gittinger <cg@exept.de>
parents: 6962
diff changeset
  3286
     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
  3287
     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
  3288
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3289
    self obsoleteMethodWarning:message from:thisContext sender
8829
9e640b6c0679 No obsolete messages in standalone apps
Stefan Vogel <sv@exept.de>
parents: 8827
diff changeset
  3290
!
9e640b6c0679 No obsolete messages in standalone apps
Stefan Vogel <sv@exept.de>
parents: 8827
diff changeset
  3291
16470
94bfe026a2cc class: Object
Claus Gittinger <cg@exept.de>
parents: 16408
diff changeset
  3292
obsoleteMethodWarning:messageOrNil from:aContext
8829
9e640b6c0679 No obsolete messages in standalone apps
Stefan Vogel <sv@exept.de>
parents: 8827
diff changeset
  3293
    "{ Pragma: +optSpace }"
9e640b6c0679 No obsolete messages in standalone apps
Stefan Vogel <sv@exept.de>
parents: 8827
diff changeset
  3294
9e640b6c0679 No obsolete messages in standalone apps
Stefan Vogel <sv@exept.de>
parents: 8827
diff changeset
  3295
    "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
  3296
     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
  3297
     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
  3298
     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
  3299
     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
  3300
     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
  3301
16470
94bfe026a2cc class: Object
Claus Gittinger <cg@exept.de>
parents: 16408
diff changeset
  3302
    |spec sender message|
8829
9e640b6c0679 No obsolete messages in standalone apps
Stefan Vogel <sv@exept.de>
parents: 8827
diff changeset
  3303
9509
bfb55a08130d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9442
diff changeset
  3304
    Smalltalk isSmalltalkDevelopmentSystem ifFalse:[
19719
f0303a38cfd6 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 19679
diff changeset
  3305
        "ignore in production systems"
f0303a38cfd6 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 19679
diff changeset
  3306
        ^ self.
8829
9e640b6c0679 No obsolete messages in standalone apps
Stefan Vogel <sv@exept.de>
parents: 8827
diff changeset
  3307
    ].
9e640b6c0679 No obsolete messages in standalone apps
Stefan Vogel <sv@exept.de>
parents: 8827
diff changeset
  3308
16470
94bfe026a2cc class: Object
Claus Gittinger <cg@exept.de>
parents: 16408
diff changeset
  3309
    message := messageOrNil ? 'Obsolete method called'.
94bfe026a2cc class: Object
Claus Gittinger <cg@exept.de>
parents: 16408
diff changeset
  3310
8829
9e640b6c0679 No obsolete messages in standalone apps
Stefan Vogel <sv@exept.de>
parents: 8827
diff changeset
  3311
    spec := aContext methodPrintString.
9e640b6c0679 No obsolete messages in standalone apps
Stefan Vogel <sv@exept.de>
parents: 8827
diff changeset
  3312
    sender := aContext sender.
9e640b6c0679 No obsolete messages in standalone apps
Stefan Vogel <sv@exept.de>
parents: 8827
diff changeset
  3313
    ('WARNING: the ''' , spec , ''' method is obsolete.') infoPrintCR.
9e640b6c0679 No obsolete messages in standalone apps
Stefan Vogel <sv@exept.de>
parents: 8827
diff changeset
  3314
    ('         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
  3315
    ('         called from ' , sender printString) infoPrintCR.
9e640b6c0679 No obsolete messages in standalone apps
Stefan Vogel <sv@exept.de>
parents: 8827
diff changeset
  3316
    (sender selector startsWith:'perform:') ifTrue:[
19719
f0303a38cfd6 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 19679
diff changeset
  3317
        sender := sender sender.
f0303a38cfd6 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 19679
diff changeset
  3318
        (sender selector startsWith:'perform:') ifTrue:[
f0303a38cfd6 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 19679
diff changeset
  3319
            sender := sender sender.
f0303a38cfd6 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 19679
diff changeset
  3320
        ].
f0303a38cfd6 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 19679
diff changeset
  3321
        ('         called from ' , sender printString) infoPrintCR.
8829
9e640b6c0679 No obsolete messages in standalone apps
Stefan Vogel <sv@exept.de>
parents: 8827
diff changeset
  3322
    ].
9e640b6c0679 No obsolete messages in standalone apps
Stefan Vogel <sv@exept.de>
parents: 8827
diff changeset
  3323
    message notNil ifTrue:[
19719
f0303a38cfd6 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 19679
diff changeset
  3324
        '------>  ' infoPrint. message infoPrintCR
16383
4cb54426f3c0 class: Object
Claus Gittinger <cg@exept.de>
parents: 16378
diff changeset
  3325
    ].
4cb54426f3c0 class: Object
Claus Gittinger <cg@exept.de>
parents: 16378
diff changeset
  3326
4cb54426f3c0 class: Object
Claus Gittinger <cg@exept.de>
parents: 16378
diff changeset
  3327
    "CG: care for standalone non-GUI progs, which have no userPreferences class"
4cb54426f3c0 class: Object
Claus Gittinger <cg@exept.de>
parents: 16378
diff changeset
  3328
    (Smalltalk isInitialized
4cb54426f3c0 class: Object
Claus Gittinger <cg@exept.de>
parents: 16378
diff changeset
  3329
    and:[ UserPreferences notNil
4cb54426f3c0 class: Object
Claus Gittinger <cg@exept.de>
parents: 16378
diff changeset
  3330
    and:[ UserPreferences current haltInObsoleteMethod]]) ifTrue:[
19719
f0303a38cfd6 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 19679
diff changeset
  3331
        "/ cg: nice try, stefan, but I don't want halts in system processes (fly by help and others)
f0303a38cfd6 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 19679
diff changeset
  3332
        Processor activeProcess isSystemProcess ifTrue:[
f0303a38cfd6 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 19679
diff changeset
  3333
            (message , ' - please fix this now (no halt in system process)') infoPrintCR
f0303a38cfd6 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 19679
diff changeset
  3334
        ] ifFalse:[
f0303a38cfd6 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 19679
diff changeset
  3335
            "/ please check for the sender of the obsoleteMethodWarning,
f0303a38cfd6 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 19679
diff changeset
  3336
            "/ and fix the code there.
f0303a38cfd6 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 19679
diff changeset
  3337
            ObsoleteMethodCallWarning raiseRequestErrorString:(message , ' - please fix this now!!')
f0303a38cfd6 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 19679
diff changeset
  3338
        ].
15716
72e323fea23f class: Object
Claus Gittinger <cg@exept.de>
parents: 15683
diff changeset
  3339
    ].
8829
9e640b6c0679 No obsolete messages in standalone apps
Stefan Vogel <sv@exept.de>
parents: 8827
diff changeset
  3340
9e640b6c0679 No obsolete messages in standalone apps
Stefan Vogel <sv@exept.de>
parents: 8827
diff changeset
  3341
    "
9e640b6c0679 No obsolete messages in standalone apps
Stefan Vogel <sv@exept.de>
parents: 8827
diff changeset
  3342
     Object obsoleteMethodWarning:'foo' from:thisContext sender sender
9e640b6c0679 No obsolete messages in standalone apps
Stefan Vogel <sv@exept.de>
parents: 8827
diff changeset
  3343
    "
9509
bfb55a08130d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9442
diff changeset
  3344
bfb55a08130d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9442
diff changeset
  3345
    "Modified: / 10-08-2006 / 13:13:11 / cg"
10558
Claus Gittinger <cg@exept.de>
parents: 10539
diff changeset
  3346
!
Claus Gittinger <cg@exept.de>
parents: 10539
diff changeset
  3347
12341
47a2bade1cbd added: #todo
Claus Gittinger <cg@exept.de>
parents: 12340
diff changeset
  3348
todo
47a2bade1cbd added: #todo
Claus Gittinger <cg@exept.de>
parents: 12340
diff changeset
  3349
    "used to mark code pieces that have to be implemented"
47a2bade1cbd added: #todo
Claus Gittinger <cg@exept.de>
parents: 12340
diff changeset
  3350
47a2bade1cbd added: #todo
Claus Gittinger <cg@exept.de>
parents: 12340
diff changeset
  3351
    <resource: #skipInDebuggersWalkBack>
47a2bade1cbd added: #todo
Claus Gittinger <cg@exept.de>
parents: 12340
diff changeset
  3352
47a2bade1cbd added: #todo
Claus Gittinger <cg@exept.de>
parents: 12340
diff changeset
  3353
    self halt:'more work needed here'.
47a2bade1cbd added: #todo
Claus Gittinger <cg@exept.de>
parents: 12340
diff changeset
  3354
47a2bade1cbd added: #todo
Claus Gittinger <cg@exept.de>
parents: 12340
diff changeset
  3355
    "
47a2bade1cbd added: #todo
Claus Gittinger <cg@exept.de>
parents: 12340
diff changeset
  3356
     example:
47a2bade1cbd added: #todo
Claus Gittinger <cg@exept.de>
parents: 12340
diff changeset
  3357
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3358
        ...
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3359
        self todo.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3360
        ...
12341
47a2bade1cbd added: #todo
Claus Gittinger <cg@exept.de>
parents: 12340
diff changeset
  3361
    "
47a2bade1cbd added: #todo
Claus Gittinger <cg@exept.de>
parents: 12340
diff changeset
  3362
!
47a2bade1cbd added: #todo
Claus Gittinger <cg@exept.de>
parents: 12340
diff changeset
  3363
10558
Claus Gittinger <cg@exept.de>
parents: 10539
diff changeset
  3364
todo:aBlock
Claus Gittinger <cg@exept.de>
parents: 10539
diff changeset
  3365
    "used to mark code pieces that have to be implemented"
Claus Gittinger <cg@exept.de>
parents: 10539
diff changeset
  3366
12341
47a2bade1cbd added: #todo
Claus Gittinger <cg@exept.de>
parents: 12340
diff changeset
  3367
    <resource: #skipInDebuggersWalkBack>
47a2bade1cbd added: #todo
Claus Gittinger <cg@exept.de>
parents: 12340
diff changeset
  3368
10558
Claus Gittinger <cg@exept.de>
parents: 10539
diff changeset
  3369
"/    self halt.
Claus Gittinger <cg@exept.de>
parents: 10539
diff changeset
  3370
"/    aBlock value.
Claus Gittinger <cg@exept.de>
parents: 10539
diff changeset
  3371
Claus Gittinger <cg@exept.de>
parents: 10539
diff changeset
  3372
    "
Claus Gittinger <cg@exept.de>
parents: 10539
diff changeset
  3373
     example:
Claus Gittinger <cg@exept.de>
parents: 10539
diff changeset
  3374
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3375
        ...
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3376
        self todo:[
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3377
            code which needs more work ...
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3378
        ].
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3379
        ...
10558
Claus Gittinger <cg@exept.de>
parents: 10539
diff changeset
  3380
    "
Claus Gittinger <cg@exept.de>
parents: 10539
diff changeset
  3381
Claus Gittinger <cg@exept.de>
parents: 10539
diff changeset
  3382
    "Created: / 25-05-2007 / 21:34:39 / cg"
Claus Gittinger <cg@exept.de>
parents: 10539
diff changeset
  3383
    "Modified: / 29-05-2007 / 12:11:33 / cg"
15683
d72a36fe05b0 class: Object
Claus Gittinger <cg@exept.de>
parents: 15645
diff changeset
  3384
!
d72a36fe05b0 class: Object
Claus Gittinger <cg@exept.de>
parents: 15645
diff changeset
  3385
d72a36fe05b0 class: Object
Claus Gittinger <cg@exept.de>
parents: 15645
diff changeset
  3386
tracePoint:someKey
d72a36fe05b0 class: Object
Claus Gittinger <cg@exept.de>
parents: 15645
diff changeset
  3387
    "{ Pragma: +optSpace }"
d72a36fe05b0 class: Object
Claus Gittinger <cg@exept.de>
parents: 15645
diff changeset
  3388
d72a36fe05b0 class: Object
Claus Gittinger <cg@exept.de>
parents: 15645
diff changeset
  3389
    "Like transcript show, but disabled by default.
d72a36fe05b0 class: Object
Claus Gittinger <cg@exept.de>
parents: 15645
diff changeset
  3390
     Can be easily enabled.
d72a36fe05b0 class: Object
Claus Gittinger <cg@exept.de>
parents: 15645
diff changeset
  3391
     Can be filtered on the arguments value (typically: a symbol).
d72a36fe05b0 class: Object
Claus Gittinger <cg@exept.de>
parents: 15645
diff changeset
  3392
     Code with tracepoints may be even checked into the source repository"
d72a36fe05b0 class: Object
Claus Gittinger <cg@exept.de>
parents: 15645
diff changeset
  3393
d72a36fe05b0 class: Object
Claus Gittinger <cg@exept.de>
parents: 15645
diff changeset
  3394
    "Example:   nil tracePoint:#stefan"
d72a36fe05b0 class: Object
Claus Gittinger <cg@exept.de>
parents: 15645
diff changeset
  3395
d72a36fe05b0 class: Object
Claus Gittinger <cg@exept.de>
parents: 15645
diff changeset
  3396
    (self isBreakPointEnabled:someKey) ifTrue:[
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3397
        ^ Transcript showCR:('Tracepoint (at %1 for %3 from %2)'
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3398
                                bindWith:(Timestamp now printString)
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3399
                                with:(thisContext sender printString)
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3400
                                with:someKey)
15683
d72a36fe05b0 class: Object
Claus Gittinger <cg@exept.de>
parents: 15645
diff changeset
  3401
    ].
d72a36fe05b0 class: Object
Claus Gittinger <cg@exept.de>
parents: 15645
diff changeset
  3402
d72a36fe05b0 class: Object
Claus Gittinger <cg@exept.de>
parents: 15645
diff changeset
  3403
    "
d72a36fe05b0 class: Object
Claus Gittinger <cg@exept.de>
parents: 15645
diff changeset
  3404
     nil tracePoint:#stefan
d72a36fe05b0 class: Object
Claus Gittinger <cg@exept.de>
parents: 15645
diff changeset
  3405
     nil tracePoint:#stefan message:'Hello'
d72a36fe05b0 class: Object
Claus Gittinger <cg@exept.de>
parents: 15645
diff changeset
  3406
     Smalltalk enableBreakPoint:#stefan.
d72a36fe05b0 class: Object
Claus Gittinger <cg@exept.de>
parents: 15645
diff changeset
  3407
     Smalltalk disableBreakPoint:#stefan.
d72a36fe05b0 class: Object
Claus Gittinger <cg@exept.de>
parents: 15645
diff changeset
  3408
    "
15723
2997392ee626 class: Object
Claus Gittinger <cg@exept.de>
parents: 15716
diff changeset
  3409
2997392ee626 class: Object
Claus Gittinger <cg@exept.de>
parents: 15716
diff changeset
  3410
    "Modified: / 28-08-2013 / 21:41:54 / cg"
15683
d72a36fe05b0 class: Object
Claus Gittinger <cg@exept.de>
parents: 15645
diff changeset
  3411
!
d72a36fe05b0 class: Object
Claus Gittinger <cg@exept.de>
parents: 15645
diff changeset
  3412
15804
cc01a011076e class: Object
Stefan Vogel <sv@exept.de>
parents: 15797
diff changeset
  3413
tracePoint:someKey message:messageBlockOrString
15683
d72a36fe05b0 class: Object
Claus Gittinger <cg@exept.de>
parents: 15645
diff changeset
  3414
    "{ Pragma: +optSpace }"
d72a36fe05b0 class: Object
Claus Gittinger <cg@exept.de>
parents: 15645
diff changeset
  3415
d72a36fe05b0 class: Object
Claus Gittinger <cg@exept.de>
parents: 15645
diff changeset
  3416
    "Like transcript show, but disabled by default.
d72a36fe05b0 class: Object
Claus Gittinger <cg@exept.de>
parents: 15645
diff changeset
  3417
     Can be easily enabled.
d72a36fe05b0 class: Object
Claus Gittinger <cg@exept.de>
parents: 15645
diff changeset
  3418
     Can be filtered on the arguments value (typically: a symbol).
d72a36fe05b0 class: Object
Claus Gittinger <cg@exept.de>
parents: 15645
diff changeset
  3419
     Code with tracepoints may be even checked into the source repository"
d72a36fe05b0 class: Object
Claus Gittinger <cg@exept.de>
parents: 15645
diff changeset
  3420
d72a36fe05b0 class: Object
Claus Gittinger <cg@exept.de>
parents: 15645
diff changeset
  3421
    "Example:   nil tracePoint:#stefan"
d72a36fe05b0 class: Object
Claus Gittinger <cg@exept.de>
parents: 15645
diff changeset
  3422
d72a36fe05b0 class: Object
Claus Gittinger <cg@exept.de>
parents: 15645
diff changeset
  3423
    (self isBreakPointEnabled:someKey) ifTrue:[
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3424
        Transcript showCR:('Tracepoint: %4 (at %1 for %3 from %2)'
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3425
                                bindWith:(Timestamp now printString)
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3426
                                with:(thisContext sender printString)
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3427
                                with:someKey
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3428
                                with:messageBlockOrString value)
15804
cc01a011076e class: Object
Stefan Vogel <sv@exept.de>
parents: 15797
diff changeset
  3429
    ].
cc01a011076e class: Object
Stefan Vogel <sv@exept.de>
parents: 15797
diff changeset
  3430
cc01a011076e class: Object
Stefan Vogel <sv@exept.de>
parents: 15797
diff changeset
  3431
    "
15683
d72a36fe05b0 class: Object
Claus Gittinger <cg@exept.de>
parents: 15645
diff changeset
  3432
     Smalltalk enableBreakPoint:#stefan.
15804
cc01a011076e class: Object
Stefan Vogel <sv@exept.de>
parents: 15797
diff changeset
  3433
     nil tracePoint:#stefan.
cc01a011076e class: Object
Stefan Vogel <sv@exept.de>
parents: 15797
diff changeset
  3434
     nil tracePoint:#stefan message:'Hello'.
cc01a011076e class: Object
Stefan Vogel <sv@exept.de>
parents: 15797
diff changeset
  3435
     nil tracePoint:#stefan message:['Hello from block'].
15683
d72a36fe05b0 class: Object
Claus Gittinger <cg@exept.de>
parents: 15645
diff changeset
  3436
     Smalltalk disableBreakPoint:#stefan.
d72a36fe05b0 class: Object
Claus Gittinger <cg@exept.de>
parents: 15645
diff changeset
  3437
    "
15723
2997392ee626 class: Object
Claus Gittinger <cg@exept.de>
parents: 15716
diff changeset
  3438
2997392ee626 class: Object
Claus Gittinger <cg@exept.de>
parents: 15716
diff changeset
  3439
    "Modified: / 28-08-2013 / 21:41:47 / cg"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3440
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3441
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3442
!Object methodsFor:'dependents access'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3443
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3444
addDependent:anObject
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3445
    "make the argument, anObject be a dependent of the receiver"
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
    |wasBlocked|
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
    "/ must do this save from interrupts, since the dependents collection
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3450
    "/ is possibly accessed from multiple threads.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3451
    "/ Used to use #valueUninterruptably here; inlined that code for slightly
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3452
    "/ faster execution.
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 := OperatingSystem blockInterrupts.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3455
    [
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3456
        |deps dep|
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3457
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3458
        deps := self dependents.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3459
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3460
        "/ to save a fair amount of memory in case of
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3461
        "/ many dependencies, we store a single dependent in
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3462
        "/ a WeakArray, and switch to a WeakSet if more dependents are
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3463
        "/ added.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3464
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3465
        (deps isNil or:[deps size == 0]) ifTrue:[
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3466
            self dependents:(WeakArray with:anObject)
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3467
        ] ifFalse:[
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3468
            deps class == WeakArray ifTrue:[
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3469
                dep := deps at:1.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3470
                dep ~~ anObject ifTrue:[
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3471
                    (dep isNil or:[dep class == SmallInteger]) ifTrue:[
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3472
                        deps at:1 put:anObject
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3473
                    ] ifFalse:[
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3474
                        self dependents:(WeakIdentitySet with:dep with:anObject)
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3475
                    ]
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3476
                ]
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3477
            ] ifFalse:[
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3478
                deps add:anObject
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3479
            ]
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3480
        ]
6421
58dca33cf0fc #valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents: 6418
diff changeset
  3481
    ] ensure:[
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3482
        wasBlocked ifFalse:[
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3483
            OperatingSystem unblockInterrupts
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3484
        ]
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3485
    ]
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3486
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3487
    "Modified: / 27.10.1997 / 19:35:52 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3488
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3489
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3490
breakDependents
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3491
    "remove all dependencies from the receiver"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3492
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3493
    self dependents:nil.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3494
    self nonWeakDependents:nil
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3495
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3496
    "Modified: / 19.4.1996 / 10:55:36 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3497
    "Created: / 27.2.1998 / 11:26:11 / stefan"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3498
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3499
8542
38f9d04fe40a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8521
diff changeset
  3500
breakDependentsRecursively
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  3501
    "remove all dependencies from the receiver and
8542
38f9d04fe40a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8521
diff changeset
  3502
     recursively from all objects referred to by the receiver."
38f9d04fe40a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8521
diff changeset
  3503
38f9d04fe40a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8521
diff changeset
  3504
    self breakDependents.
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  3505
    1 to:self class instSize do:[:idx |
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3506
        (self instVarAt:idx) breakDependentsRecursively.
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  3507
    ].
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  3508
    1 to:self basicSize do:[:idx |
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3509
        (self basicAt:idx) breakDependentsRecursively.
8542
38f9d04fe40a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8521
diff changeset
  3510
    ]
38f9d04fe40a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8521
diff changeset
  3511
!
38f9d04fe40a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8521
diff changeset
  3512
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3513
dependents
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3514
    "return a Collection of dependents.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3515
     The default implementation here uses a global WeakDictionary to store
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  3516
     dependents
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3517
     This may be too slow for high frequency change&update,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3518
     therefore, some classes (Model) redefine this for better performance.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3519
     Notice the mentioning of a WeakDictionary - read the classes documentation."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3520
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3521
    |deps|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3522
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3523
    (deps := Dependencies at:self ifAbsent:nil) isNil ifTrue:[
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3524
        ^ #().
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3525
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3526
    ^ deps
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3527
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3528
    "Modified: / 26.1.1998 / 11:18:15 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3529
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3530
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3531
dependents:aCollection
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3532
    "set the collection of dependents.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3533
     The default implementation here uses a global Dictionary to store
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3534
     dependents which may be too slow for high frequency change&update.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3535
     Therefore, some classes (Model) redefine this for better performance."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3536
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3537
    "/ must do this save from interrupts, since the dependents collection
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3538
    "/ is possibly accessed from multiple threads.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3539
    "/ Used to use #valueUninterruptably here; inlined that code for slightly
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3540
    "/ faster execution (and to avoid creation of garbage blocks).
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
    (OperatingSystem blockInterrupts) ifTrue:[
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3543
        "/ the common case - already blocked
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3544
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3545
        (aCollection isNil or:[aCollection isEmpty]) ifTrue:[
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3546
            Dependencies removeKey:self ifAbsent:nil
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3547
        ] ifFalse:[
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3548
            Dependencies at:self put:aCollection
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3549
        ].
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3550
        ^ self
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3551
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3552
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3553
    [
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3554
        (aCollection isNil or:[aCollection isEmpty]) ifTrue:[
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3555
            Dependencies removeKey:self ifAbsent:nil
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3556
        ] ifFalse:[
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3557
            Dependencies at:self put:aCollection
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3558
        ].
6421
58dca33cf0fc #valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents: 6418
diff changeset
  3559
    ] ensure:[
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3560
        OperatingSystem unblockInterrupts
5755
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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3563
    "Modified: 30.1.1997 / 21:22:10 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3564
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3565
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3566
dependentsDo:aBlock
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3567
    "evaluate aBlock for all of my dependents"
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
    |deps nwDeps|
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
    deps := self dependents.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3572
    deps size ~~ 0 ifTrue:[
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3573
        deps do:[:d |
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3574
                    (d notNil and:[d class ~~ SmallInteger]) ifTrue:[
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3575
                        aBlock value:d
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3576
                    ]
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3577
                ]
5755
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
    nwDeps := self nonWeakDependents.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3580
    (nwDeps ~~ deps and:[nwDeps size ~~ 0]) ifTrue:[
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3581
        nwDeps do:aBlock
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3582
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3583
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3584
    "Modified: / 30.1.1998 / 14:03:40 / cg"
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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3587
myDependents
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3588
    "same as dependents - ST-80 compatibility"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3589
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3590
    ^ self dependents
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3591
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3592
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3593
release
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3594
    "remove all references to objects that may refer to self.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3595
     Subclasses may redefine this method but should do a 'super release'."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3596
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3597
    self breakDependents
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3598
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3599
    "Modified: / 27.2.1998 / 11:29:35 / stefan"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3600
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3601
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3602
removeDependent:anObject
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3603
    "make the argument, anObject be independent of the receiver"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3604
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3605
    |wasBlocked|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3606
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3607
    "/ must do this save from interrupts, since the dependents collection
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3608
    "/ is possibly accessed from multiple threads.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3609
    "/ Used to use #valueUninterruptably here; inlined that code for slightly
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3610
    "/ faster execution.
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
    wasBlocked := OperatingSystem blockInterrupts.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3613
    [
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3614
        |deps n d|
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3615
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3616
        deps := self dependents.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3617
        deps size ~~ 0 ifTrue:[
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3618
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3619
            "/ to save a fair amount of memory in case of
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3620
            "/ many dependencies, we store a single dependent in
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3621
            "/ a WeakArray, and switch to a WeakSet if more dependents are
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3622
            "/ added. Here we have to do the inverse ...
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3623
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3624
            ((deps class == WeakArray) or:[deps class == Array]) ifTrue:[
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3625
                ((d := deps at:1) == anObject
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3626
                or:[d isNil
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3627
                or:[d class == SmallInteger]]) ifTrue:[
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3628
                    self dependents:nil
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3629
                ]
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3630
            ] ifFalse:[
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3631
                deps remove:anObject ifAbsent:[].
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3632
                (n := deps size) == 0 ifTrue:[
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3633
                    self dependents:nil
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3634
                ] ifFalse:[
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3635
                    n == 1 ifTrue:[
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3636
                        d := deps firstIfEmpty:nil.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3637
                        d notNil ifTrue:[
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3638
                            deps := (deps isWeakCollection ifTrue:[WeakArray] ifFalse:[Array]) with:d
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3639
                        ] ifFalse:[
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3640
                            deps := nil
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3641
                        ].
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3642
                        self dependents:deps.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3643
                    ]
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3644
                ]
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3645
            ]
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3646
        ]
6421
58dca33cf0fc #valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents: 6418
diff changeset
  3647
    ] ensure:[
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3648
        wasBlocked ifFalse:[
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3649
            OperatingSystem unblockInterrupts
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3650
        ]
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3651
    ]
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3652
13500
51b2e6c6c2ac changed:
Claus Gittinger <cg@exept.de>
parents: 13488
diff changeset
  3653
    "Modified: / 05-07-2011 / 22:49:31 / cg"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3654
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3655
7266
f2b64d3b43cf method category rename
Claus Gittinger <cg@exept.de>
parents: 7261
diff changeset
  3656
!Object methodsFor:'dependents access (non weak)'!
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3657
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3658
addNonWeakDependent:anObject
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3659
    "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
  3660
     Be careful: this nonWeakDependency will prevent the dependent from being
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3661
     garbage collected unless the dependency is removed.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3662
     This is a private mechanism, for directed dependencies."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3663
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3664
    |wasBlocked|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3665
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3666
    "/ must do this save from interrupts, since the dependents collection
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3667
    "/ is possibly accessed from multiple threads.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3668
    "/ Used to use #valueUninterruptably here; inlined that code for slightly
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3669
    "/ faster execution.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3670
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3671
    wasBlocked := OperatingSystem blockInterrupts.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3672
    [
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3673
        |deps dep|
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3674
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3675
        deps := self nonWeakDependents.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3676
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3677
        "/ to save a fair amount of memory in case of
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3678
        "/ many dependencies, we store a single dependent in
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3679
        "/ an Array, and switch to a Set if more dependents are
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3680
        "/ added.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3681
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3682
        deps size == 0 ifTrue:[
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3683
            anObject notNil ifTrue:[
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3684
                self nonWeakDependents:(Array with:anObject).
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3685
            ] ifFalse:[
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3686
                "adding nil causes problems when adding the next one
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3687
                 (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
  3688
"/                self halt:'try to add nil to list of dependents'.
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3689
            ].
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3690
        ] ifFalse:[
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3691
            deps class == Array ifTrue:[
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3692
                dep := deps at:1.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3693
                dep ~~ anObject ifTrue:[
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3694
                    self nonWeakDependents:(IdentitySet with:dep with:anObject)
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3695
                ]
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3696
            ] ifFalse:[
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3697
                deps add:anObject
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3698
            ]
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3699
        ]
6421
58dca33cf0fc #valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents: 6418
diff changeset
  3700
    ] ensure:[
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3701
        wasBlocked ifFalse:[
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3702
            OperatingSystem unblockInterrupts
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3703
        ]
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3704
    ]
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3705
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3706
    "Created: / 19.4.1996 / 10:54:08 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3707
    "Modified: / 30.1.1998 / 14:03:08 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3708
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3709
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3710
nonWeakDependents
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3711
    "return a Collection of nonWeakDependents - empty if there is none.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3712
     This is a private mechanism for directed dependencies."
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
    NonWeakDependencies isNil ifTrue:[^ #()].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3715
    ^ NonWeakDependencies at:self ifAbsent:#()
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3716
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3717
    "Created: / 19.4.1996 / 10:55:06 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3718
    "Modified: / 30.1.1998 / 14:06:47 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3719
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3720
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3721
nonWeakDependents:aCollection
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3722
    "set the collection of nonWeak dependents.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3723
     This is a private helper for directed dependencies."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3724
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3725
    [
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3726
        (aCollection isNil or:[aCollection isEmpty]) ifTrue:[
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3727
            NonWeakDependencies removeKey:self ifAbsent:nil
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3728
        ] ifFalse:[
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3729
            NonWeakDependencies at:self put:aCollection
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3730
        ]
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3731
    ] valueUninterruptably
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3732
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3733
    "Created: 19.4.1996 / 11:07:47 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3734
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3735
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3736
removeNonWeakDependent:anObject
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3737
    "remove a nonWeak dependency from the receiver to the argument, anObject.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3738
     (i.e. make it independent of the receiver)"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3739
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3740
    |wasBlocked|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3741
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3742
    "/ must do this save from interrupts, since the dependents collection
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3743
    "/ is possibly accessed from multiple threads.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3744
    "/ Used to use #valueUninterruptably here; inlined that code for slightly
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3745
    "/ faster execution.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3746
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3747
    wasBlocked := OperatingSystem blockInterrupts.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3748
    [
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3749
        |deps n|
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3750
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3751
        deps := self nonWeakDependents.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3752
        deps size ~~ 0 ifTrue:[
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3753
            deps class == Array ifTrue:[
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3754
                (deps at:1) == anObject ifTrue:[
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3755
                    self nonWeakDependents:nil
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3756
                ]
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3757
            ] ifFalse:[
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3758
                deps remove:anObject ifAbsent:[].
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3759
                (n := deps size) == 0 ifTrue:[
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3760
                    self nonWeakDependents:nil
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3761
                ] ifFalse:[
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3762
                    n == 1 ifTrue:[
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3763
                        self nonWeakDependents:(Array with:(deps first))
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3764
                    ]
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3765
                ]
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3766
            ]
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3767
        ]
6421
58dca33cf0fc #valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents: 6418
diff changeset
  3768
    ] ensure:[
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3769
        wasBlocked ifFalse:[
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3770
            OperatingSystem unblockInterrupts
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3771
        ]
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3772
    ]
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3773
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3774
    "Created: / 19.4.1996 / 11:44:44 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3775
    "Modified: / 30.1.1998 / 14:04:01 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3776
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3777
9279
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3778
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3779
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3780
!Object methodsFor:'displaying'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3781
7081
4e1ae4a0b3c1 added ascentOn: (display-ascent);
Claus Gittinger <cg@exept.de>
parents: 7048
diff changeset
  3782
ascentOn:aGC
4e1ae4a0b3c1 added ascentOn: (display-ascent);
Claus Gittinger <cg@exept.de>
parents: 7048
diff changeset
  3783
    "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
  3784
     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
  3785
     coordinate is given by y.
4e1ae4a0b3c1 added ascentOn: (display-ascent);
Claus Gittinger <cg@exept.de>
parents: 7048
diff changeset
  3786
     In other words: some draw above the given y coordinate.
4e1ae4a0b3c1 added ascentOn: (display-ascent);
Claus Gittinger <cg@exept.de>
parents: 7048
diff changeset
  3787
     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
  3788
     the given y coordinate."
4e1ae4a0b3c1 added ascentOn: (display-ascent);
Claus Gittinger <cg@exept.de>
parents: 7048
diff changeset
  3789
11065
17c01b01000f Simplify (and speed up) #ascentOn:
Stefan Vogel <sv@exept.de>
parents: 11048
diff changeset
  3790
    ^ aGC fontAscent
7081
4e1ae4a0b3c1 added ascentOn: (display-ascent);
Claus Gittinger <cg@exept.de>
parents: 7048
diff changeset
  3791
!
4e1ae4a0b3c1 added ascentOn: (display-ascent);
Claus Gittinger <cg@exept.de>
parents: 7048
diff changeset
  3792
6900
3b1eafe032b2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6884
diff changeset
  3793
displayOn:aGCOrStream
7081
4e1ae4a0b3c1 added ascentOn: (display-ascent);
Claus Gittinger <cg@exept.de>
parents: 7048
diff changeset
  3794
    "Compatibility
4e1ae4a0b3c1 added ascentOn: (display-ascent);
Claus Gittinger <cg@exept.de>
parents: 7048
diff changeset
  3795
     append a printed desription on some stream (Dolphin,  Squeak)
4e1ae4a0b3c1 added ascentOn: (display-ascent);
Claus Gittinger <cg@exept.de>
parents: 7048
diff changeset
  3796
     OR:
4e1ae4a0b3c1 added ascentOn: (display-ascent);
Claus Gittinger <cg@exept.de>
parents: 7048
diff changeset
  3797
     display the receiver in a graphicsContext at 0@0 (ST80).
4e1ae4a0b3c1 added ascentOn: (display-ascent);
Claus Gittinger <cg@exept.de>
parents: 7048
diff changeset
  3798
     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
  3799
     (although the fallBack is to display its printString ...)"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3800
7081
4e1ae4a0b3c1 added ascentOn: (display-ascent);
Claus Gittinger <cg@exept.de>
parents: 7048
diff changeset
  3801
    "/ what a kludge - Dolphin and Squeak mean: printOn: a stream;
4e1ae4a0b3c1 added ascentOn: (display-ascent);
Claus Gittinger <cg@exept.de>
parents: 7048
diff changeset
  3802
    "/ 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
  3803
    aGCOrStream isStream ifTrue:[
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3804
        self printOn:aGCOrStream.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3805
        ^ self
6900
3b1eafe032b2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6884
diff changeset
  3806
    ].
3b1eafe032b2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6884
diff changeset
  3807
    ^ self displayOn:aGCOrStream x:0 y:0.
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
    "Created: 29.5.1996 / 16:28:58 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3810
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3811
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3812
displayOn:aGC at:aPoint
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3813
    "ST-80 Compatibility
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3814
     display the receiver in a graphicsContext - this method allows
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3815
     for any object to be displayed in a ListView - for example."
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
    ^ self displayOn:aGC x:(aPoint x) y:(aPoint y).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3818
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3819
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3820
displayOn:aGC x:x y:y
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3821
    "display the receiver in a graphicsContext - this method allows
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3822
     for any object to be displayed in a ListView - for example."
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
    self displayOn:aGC x:x y:y opaque:false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3825
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3826
    "Modified: 29.5.1996 / 16:29:38 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3827
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3828
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3829
displayOn:aGc x:x y:y opaque:opaque
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3830
    "display the receiver in a graphicsContext - this method allows
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3831
     for any object to be displayed in a ListView - for example.
19451
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  3832
     The fallBack here shows the receiver's displayString.
7215
733294e1a8cc correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 7211
diff changeset
  3833
     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
  3834
     ask using #ascentOn: if required"
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
    |s yBaseline|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3837
15368
1509922b75ec class: Object
Claus Gittinger <cg@exept.de>
parents: 15362
diff changeset
  3838
    s := self isString ifTrue:[self] ifFalse:[self displayString].
7215
733294e1a8cc correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 7211
diff changeset
  3839
    yBaseline := y "+ aGc font ascent".
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3840
    opaque ifTrue:[
19451
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  3841
        aGc displayOpaqueString:s x:x y:yBaseline.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3842
    ] ifFalse:[
19451
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  3843
        aGc displayString:s x:x y:yBaseline.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3844
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3845
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3846
    "Modified: 29.5.1996 / 16:29:38 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3847
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3848
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3849
displayOpaqueOn:aGC x:x y:y
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3850
    "display the receiver in a graphicsContext - this method allows
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3851
     for any object to be displayed in a ListView - for example."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3852
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3853
    self displayOn:aGC x:x y:y opaque:true
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3854
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3855
    "Modified: / 29.5.1996 / 16:29:38 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3856
    "Created: / 26.10.1997 / 15:01:36 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3857
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3858
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3859
displayString
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3860
    "return a string used when displaying the receiver in a view;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3861
     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
  3862
     but sometimes redefined for a better look.
1cbc2d35aa17 Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents: 14272
diff changeset
  3863
1cbc2d35aa17 Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents: 14272
diff changeset
  3864
     Note: the base method (used by the inspector) is #displayOn:.
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3865
           So you should implement #displayOn: instead of #displayString in subclasses."
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3866
7081
4e1ae4a0b3c1 added ascentOn: (display-ascent);
Claus Gittinger <cg@exept.de>
parents: 7048
diff changeset
  3867
    |s|
4e1ae4a0b3c1 added ascentOn: (display-ascent);
Claus Gittinger <cg@exept.de>
parents: 7048
diff changeset
  3868
15942
a76da2251215 handle weak objects (with instances or non-WeakArray)
Claus Gittinger <cg@exept.de>
parents: 15932
diff changeset
  3869
    "/ attention: TextStream is not present in ultra-mini standalone apps
15932
61bf45ec26c9 fixed displayString for systems without libbasic2
Claus Gittinger <cg@exept.de>
parents: 15931
diff changeset
  3870
    s := TextStream isNil
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3871
            ifTrue:['' writeStream]
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  3872
            ifFalse:[TextStream on:(String new:32)].
7081
4e1ae4a0b3c1 added ascentOn: (display-ascent);
Claus Gittinger <cg@exept.de>
parents: 7048
diff changeset
  3873
    self displayOn:s.
4e1ae4a0b3c1 added ascentOn: (display-ascent);
Claus Gittinger <cg@exept.de>
parents: 7048
diff changeset
  3874
    ^ s contents
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3875
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3876
    "
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  3877
     #(1 2 3) printString
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  3878
     #(1 2 3) displayString
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3879
     #(1 2 3) storeString
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3880
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3881
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3882
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3883
heightOn:aGC
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3884
    "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
  3885
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3886
    ^ (aGC font onDevice:aGC device) heightOf:(self displayString)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3887
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3888
16010
6bb36b8b4f4a class: Object
Claus Gittinger <cg@exept.de>
parents: 15943
diff changeset
  3889
printStringForPrintIt
6bb36b8b4f4a class: Object
Claus Gittinger <cg@exept.de>
parents: 15943
diff changeset
  3890
    "for compatibility (used to be displayString), now the printIt menu function now sends this message"
6bb36b8b4f4a class: Object
Claus Gittinger <cg@exept.de>
parents: 15943
diff changeset
  3891
6bb36b8b4f4a class: Object
Claus Gittinger <cg@exept.de>
parents: 15943
diff changeset
  3892
    ^ self displayString
6bb36b8b4f4a class: Object
Claus Gittinger <cg@exept.de>
parents: 15943
diff changeset
  3893
6bb36b8b4f4a class: Object
Claus Gittinger <cg@exept.de>
parents: 15943
diff changeset
  3894
    "
6bb36b8b4f4a class: Object
Claus Gittinger <cg@exept.de>
parents: 15943
diff changeset
  3895
     #(1 2 3) printString
6bb36b8b4f4a class: Object
Claus Gittinger <cg@exept.de>
parents: 15943
diff changeset
  3896
     #(1 2 3) printStringForPrintIt
6bb36b8b4f4a class: Object
Claus Gittinger <cg@exept.de>
parents: 15943
diff changeset
  3897
     #(1 2 3) storeString
6bb36b8b4f4a class: Object
Claus Gittinger <cg@exept.de>
parents: 15943
diff changeset
  3898
    "
6bb36b8b4f4a class: Object
Claus Gittinger <cg@exept.de>
parents: 15943
diff changeset
  3899
!
6bb36b8b4f4a class: Object
Claus Gittinger <cg@exept.de>
parents: 15943
diff changeset
  3900
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  3901
widthFrom:startIndex to:endIndex on:aGC
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  3902
    "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
  3903
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  3904
    ^ (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
  3905
!
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  3906
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3907
widthOn:aGC
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3908
    "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
  3909
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3910
    ^ (aGC font onDevice:aGC device) widthOf:(self displayString)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3911
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3912
7359
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3913
!Object methodsFor:'double dispatching'!
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3914
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3915
equalFromComplex:aComplex
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3916
    "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
  3917
     and return false from this comparison.
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3918
     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
  3919
     which uses #= (i.e. a Set or Dictionary)."
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3920
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3921
    ^ false
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3922
!
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3923
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3924
equalFromFixedPoint:aFixedPoint
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3925
    "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
  3926
     and return false from this comparison.
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3927
     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
  3928
     which uses #= (i.e. a Set or Dictionary)."
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3929
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3930
    ^ false
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3931
!
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3932
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3933
equalFromFloat:aFloat
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3934
    "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
  3935
     and return false from this comparison.
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3936
     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
  3937
     which uses #= (i.e. a Set or Dictionary)."
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3938
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3939
    ^ false
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3940
!
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3941
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3942
equalFromFraction:aFraction
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3943
    "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
  3944
     and return false from this comparison.
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3945
     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
  3946
     which uses #= (i.e. a Set or Dictionary)."
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3947
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3948
    ^ false
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3949
!
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3950
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3951
equalFromInteger:anInteger
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3952
    "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
  3953
     and return false from this comparison.
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3954
     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
  3955
     which uses #= (i.e. a Set or Dictionary)."
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3956
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3957
    ^ false
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3958
!
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3959
7455
6abc135763f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7402
diff changeset
  3960
equalFromLargeFloat:aLargeFloat
6abc135763f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7402
diff changeset
  3961
    "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
  3962
     and return false from this comparison.
6abc135763f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7402
diff changeset
  3963
     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
  3964
     which uses #= (i.e. a Set or Dictionary)."
6abc135763f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7402
diff changeset
  3965
6abc135763f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7402
diff changeset
  3966
    ^ false
6abc135763f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7402
diff changeset
  3967
!
6abc135763f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7402
diff changeset
  3968
7359
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3969
equalFromLongFloat:aLongFloat
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3970
    "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
  3971
     and return false from this comparison.
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3972
     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
  3973
     which uses #= (i.e. a Set or Dictionary)."
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3974
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3975
    ^ false
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3976
!
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3977
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3978
equalFromShortFloat:aShortFloat
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3979
    "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
  3980
     and return false from this comparison.
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3981
     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
  3982
     which uses #= (i.e. a Set or Dictionary)."
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3983
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3984
    ^ false
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3985
! !
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  3986
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3987
!Object methodsFor:'encoding & decoding'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3988
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3989
decodeAsLiteralArray
8832
8210e23f6c32 Speed up #literalArrayEncoding
Stefan Vogel <sv@exept.de>
parents: 8829
diff changeset
  3990
    "given a literalEncoding in the receiver,
8210e23f6c32 Speed up #literalArrayEncoding
Stefan Vogel <sv@exept.de>
parents: 8829
diff changeset
  3991
     create & return the corresponding object.
8210e23f6c32 Speed up #literalArrayEncoding
Stefan Vogel <sv@exept.de>
parents: 8829
diff changeset
  3992
     The inverse operation to #literalArrayEncoding."
8210e23f6c32 Speed up #literalArrayEncoding
Stefan Vogel <sv@exept.de>
parents: 8829
diff changeset
  3993
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3994
    ^ self
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3995
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3996
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3997
encodeOn:anEncoder with:aParameter
8397
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  3998
    "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
  3999
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  4000
    <resource: #obsolete>
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  4001
8404
c0bd2a56dc3b *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 8397
diff changeset
  4002
    self acceptVisitor:anEncoder with:aParameter
6718
6d91ccd79d53 Encoding stuff
Stefan Vogel <sv@exept.de>
parents: 6716
diff changeset
  4003
!
6d91ccd79d53 Encoding stuff
Stefan Vogel <sv@exept.de>
parents: 6716
diff changeset
  4004
6d91ccd79d53 Encoding stuff
Stefan Vogel <sv@exept.de>
parents: 6716
diff changeset
  4005
encodingVectorForInstanceVariables
8397
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  4006
    "OBSOLETE, use elementDescriptorForInstanceVariables"
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  4007
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  4008
    <resource: #obsolete>
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  4009
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  4010
    ^ self elementDescriptorForInstanceVariablesMatching:[:val | true].
6718
6d91ccd79d53 Encoding stuff
Stefan Vogel <sv@exept.de>
parents: 6716
diff changeset
  4011
6d91ccd79d53 Encoding stuff
Stefan Vogel <sv@exept.de>
parents: 6716
diff changeset
  4012
    "
6d91ccd79d53 Encoding stuff
Stefan Vogel <sv@exept.de>
parents: 6716
diff changeset
  4013
      #(1 2 3 nil true symbol) encodingVectorForInstanceVariables
6d91ccd79d53 Encoding stuff
Stefan Vogel <sv@exept.de>
parents: 6716
diff changeset
  4014
      Dictionary new encodingVectorForInstanceVariables
6d91ccd79d53 Encoding stuff
Stefan Vogel <sv@exept.de>
parents: 6716
diff changeset
  4015
      (5 @ nil) encodingVectorForInstanceVariables
6d91ccd79d53 Encoding stuff
Stefan Vogel <sv@exept.de>
parents: 6716
diff changeset
  4016
    "
6d91ccd79d53 Encoding stuff
Stefan Vogel <sv@exept.de>
parents: 6716
diff changeset
  4017
!
6d91ccd79d53 Encoding stuff
Stefan Vogel <sv@exept.de>
parents: 6716
diff changeset
  4018
6d91ccd79d53 Encoding stuff
Stefan Vogel <sv@exept.de>
parents: 6716
diff changeset
  4019
encodingVectorForNonNilInstanceVariables
8397
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  4020
    "OBSOLETE, use elementDescriptorForNonNilInstanceVariables"
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  4021
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  4022
    <resource: #obsolete>
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  4023
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  4024
    ^ self elementDescriptorForInstanceVariablesMatching:[:varVal | varVal notNil].
6718
6d91ccd79d53 Encoding stuff
Stefan Vogel <sv@exept.de>
parents: 6716
diff changeset
  4025
6d91ccd79d53 Encoding stuff
Stefan Vogel <sv@exept.de>
parents: 6716
diff changeset
  4026
    "
6d91ccd79d53 Encoding stuff
Stefan Vogel <sv@exept.de>
parents: 6716
diff changeset
  4027
      #(1 2 3 nil true symbol) encodingVectorForNonNilInstanceVariables
6d91ccd79d53 Encoding stuff
Stefan Vogel <sv@exept.de>
parents: 6716
diff changeset
  4028
      (5 @ nil) encodingVectorForNonNilInstanceVariables
6d91ccd79d53 Encoding stuff
Stefan Vogel <sv@exept.de>
parents: 6716
diff changeset
  4029
    "
6d91ccd79d53 Encoding stuff
Stefan Vogel <sv@exept.de>
parents: 6716
diff changeset
  4030
!
6d91ccd79d53 Encoding stuff
Stefan Vogel <sv@exept.de>
parents: 6716
diff changeset
  4031
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4032
fromLiteralArrayEncoding:aSpecArray
8798
73676c762813 comment
Claus Gittinger <cg@exept.de>
parents: 8789
diff changeset
  4033
    "read my attributes from aSpecArray.
73676c762813 comment
Claus Gittinger <cg@exept.de>
parents: 8789
diff changeset
  4034
     Recursively decodes arguments."
73676c762813 comment
Claus Gittinger <cg@exept.de>
parents: 8789
diff changeset
  4035
19802
d7d4c355736e #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 19799
diff changeset
  4036
    |sel litVal val msg ex
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4037
     stop   "{ Class:SmallInteger }" |
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
    stop := aSpecArray size.
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
    2 to:stop by:2 do:[:i|
19799
16ce93537a54 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 19784
diff changeset
  4042
        sel := aSpecArray at:i.
16ce93537a54 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 19784
diff changeset
  4043
        litVal := aSpecArray at:i + 1.
16ce93537a54 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 19784
diff changeset
  4044
16ce93537a54 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 19784
diff changeset
  4045
        (self respondsTo:sel) ifTrue:[
16ce93537a54 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 19784
diff changeset
  4046
            val := litVal decodeAsLiteralArray.
16ce93537a54 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 19784
diff changeset
  4047
            self perform:sel with:val
16ce93537a54 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 19784
diff changeset
  4048
        ] ifFalse:[
16ce93537a54 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 19784
diff changeset
  4049
            "/ that's a debug halt,
16ce93537a54 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 19784
diff changeset
  4050
            "/ it should probably be removed (to simply ignore unhandled attributes)...
16ce93537a54 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 19784
diff changeset
  4051
            "/ for now, it is left in, in order to easily find incompatibilities between
16ce93537a54 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 19784
diff changeset
  4052
            "/ VW and ST/X.
16ce93537a54 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 19784
diff changeset
  4053
            self breakPoint:#cg.
16ce93537a54 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 19784
diff changeset
  4054
16ce93537a54 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 19784
diff changeset
  4055
            msg := '%1: unhandled literalArrayEncoding attribute:'
16ce93537a54 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 19784
diff changeset
  4056
                        bindWith:self class name
16ce93537a54 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 19784
diff changeset
  4057
                        with:sel.
16ce93537a54 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 19784
diff changeset
  4058
            UnhandledAttributeInLiteralArrayErrorSignal isHandled ifTrue:[
19802
d7d4c355736e #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 19799
diff changeset
  4059
                ex := UnhandledAttributeInLiteralArrayErrorSignal new.
d7d4c355736e #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 19799
diff changeset
  4060
                ex badLiteralArray:self.
d7d4c355736e #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 19799
diff changeset
  4061
                ex parameter:sel.
d7d4c355736e #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 19799
diff changeset
  4062
                ex notify:msg.
19799
16ce93537a54 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 19784
diff changeset
  4063
            ] ifFalse:[
16ce93537a54 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 19784
diff changeset
  4064
                msg infoPrintCR.
16ce93537a54 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 19784
diff changeset
  4065
            ].
16ce93537a54 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 19784
diff changeset
  4066
        ]
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4067
    ]
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4068
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4069
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4070
literalArrayEncoding
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4071
    "generate a literalArrayEncoding array for myself.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4072
     This uses #literalArrayEncodingSlotOrder which defines the slots and
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4073
     order and #skippedInLiteralEncoding which defines slots to skip.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4074
     For most subclasses, there is no need to redefine those."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4075
8832
8210e23f6c32 Speed up #literalArrayEncoding
Stefan Vogel <sv@exept.de>
parents: 8829
diff changeset
  4076
    |names encoding cls skipped slots|
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4077
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4078
    self isLiteral ifTrue:[
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  4079
        ^ self
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4080
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4081
8832
8210e23f6c32 Speed up #literalArrayEncoding
Stefan Vogel <sv@exept.de>
parents: 8829
diff changeset
  4082
    slots    := self literalArrayEncodingSlotOrder.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4083
    skipped  := self skippedInLiteralEncoding.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4084
    cls      := self class.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4085
    names    := cls allInstVarNames.
8832
8210e23f6c32 Speed up #literalArrayEncoding
Stefan Vogel <sv@exept.de>
parents: 8829
diff changeset
  4086
    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
  4087
    encoding add:cls name.
8832
8210e23f6c32 Speed up #literalArrayEncoding
Stefan Vogel <sv@exept.de>
parents: 8829
diff changeset
  4088
8210e23f6c32 Speed up #literalArrayEncoding
Stefan Vogel <sv@exept.de>
parents: 8829
diff changeset
  4089
    slots do:[:instSlot |
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  4090
        |value nm|
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  4091
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  4092
        nm := names at:instSlot.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  4093
        (skipped includes:nm) ifFalse:[
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  4094
            (value := self instVarAt:instSlot) notNil ifTrue:[
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  4095
                encoding add:(nm asMutator).
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  4096
                encoding add:value literalArrayEncoding
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  4097
            ]
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  4098
        ]
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4099
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4100
    ^ encoding asArray
8841
d5acf50ec5a6 Comment
Stefan Vogel <sv@exept.de>
parents: 8839
diff changeset
  4101
d5acf50ec5a6 Comment
Stefan Vogel <sv@exept.de>
parents: 8839
diff changeset
  4102
    "
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  4103
        (1 -> 2) literalArrayEncoding
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  4104
        DebugView menuSpec decodeAsLiteralArray literalArrayEncoding  =
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  4105
           DebugView menuSpec
8841
d5acf50ec5a6 Comment
Stefan Vogel <sv@exept.de>
parents: 8839
diff changeset
  4106
    "
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4107
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4108
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4109
literalArrayEncodingSlotOrder
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4110
    "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
  4111
     a literalArrayEncoding"
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  4112
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4113
    ^ 1 to:self class instSize
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4114
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4115
7112
6299f5d9129c added postDecodeFrom - to allow for an object to
martin
parents: 7094
diff changeset
  4116
postDecodeFrom:aDecoder aspect:aspectSymbol
6299f5d9129c added postDecodeFrom - to allow for an object to
martin
parents: 7094
diff changeset
  4117
    "invoked by xmlDecoder (and others in the future), after an
6299f5d9129c added postDecodeFrom - to allow for an object to
martin
parents: 7094
diff changeset
  4118
     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
  4119
8397
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  4120
    ^ self
7112
6299f5d9129c added postDecodeFrom - to allow for an object to
martin
parents: 7094
diff changeset
  4121
!
6299f5d9129c added postDecodeFrom - to allow for an object to
martin
parents: 7094
diff changeset
  4122
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4123
skippedInLiteralEncoding
8397
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  4124
    "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
  4125
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4126
    ^ #()
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4127
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4128
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4129
!Object methodsFor:'error handling'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4130
16012
10e4d76d9a0c class: Object
Claus Gittinger <cg@exept.de>
parents: 16011
diff changeset
  4131
abortOperation
10e4d76d9a0c class: Object
Claus Gittinger <cg@exept.de>
parents: 16011
diff changeset
  4132
    "{ Pragma: +optSpace }"
10e4d76d9a0c class: Object
Claus Gittinger <cg@exept.de>
parents: 16011
diff changeset
  4133
10e4d76d9a0c class: Object
Claus Gittinger <cg@exept.de>
parents: 16011
diff changeset
  4134
    "raise the AbortOperationRequest signal.
10e4d76d9a0c class: Object
Claus Gittinger <cg@exept.de>
parents: 16011
diff changeset
  4135
     This will unwind and bring the current thread back to the event-handling loop,
10e4d76d9a0c class: Object
Claus Gittinger <cg@exept.de>
parents: 16011
diff changeset
  4136
     effectively aborting any current menu, user, doIt, printIt or other operation."
10e4d76d9a0c class: Object
Claus Gittinger <cg@exept.de>
parents: 16011
diff changeset
  4137
10e4d76d9a0c class: Object
Claus Gittinger <cg@exept.de>
parents: 16011
diff changeset
  4138
    <resource: #skipInDebuggersWalkBack>
10e4d76d9a0c class: Object
Claus Gittinger <cg@exept.de>
parents: 16011
diff changeset
  4139
10e4d76d9a0c class: Object
Claus Gittinger <cg@exept.de>
parents: 16011
diff changeset
  4140
    ^ AbortOperationRequest raise
10e4d76d9a0c class: Object
Claus Gittinger <cg@exept.de>
parents: 16011
diff changeset
  4141
!
10e4d76d9a0c class: Object
Claus Gittinger <cg@exept.de>
parents: 16011
diff changeset
  4142
13416
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  4143
ambiguousMessage:aMessage
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  4144
    "this message is sent by the system in case that it
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  4145
     is not clear which method to execute in response to
14632
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14539
diff changeset
  4146
     aMessage.
13416
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  4147
     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
  4148
     imports two namespaces and both define a method with the
13416
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  4149
     requested selector."
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  4150
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  4151
    <context: #return>
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  4152
    <resource: #skipInDebuggersWalkBack>
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  4153
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  4154
    ^ AmbiguousMessage raiseRequestWith:aMessage
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  4155
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  4156
    "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
  4157
    "Modified (comment): / 02-11-2012 / 10:14:42 / cg"
13416
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  4158
!
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  4159
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4160
cannotSendMessage:aMessage to:someReceiver
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4161
    "this message is sent by the runtime system (VM),
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4162
     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
  4163
     a valid behavior (see documentation in Behavior)."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4164
11021
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4165
    <resource: #skipInDebuggersWalkBack>
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4166
8330
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
  4167
    ^ VMInternalError
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  4168
          raiseWith:someReceiver
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  4169
          errorString:('bad class in send of #' , aMessage selector)
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
    "Modified: 23.1.1997 / 00:05:39 / 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
11132
e5bd3a66ca80 conversion errors (specific error classes)
Claus Gittinger <cg@exept.de>
parents: 11068
diff changeset
  4174
conversionErrorSignal
e5bd3a66ca80 conversion errors (specific error classes)
Claus Gittinger <cg@exept.de>
parents: 11068
diff changeset
  4175
    "return the signal used for conversion error handling"
e5bd3a66ca80 conversion errors (specific error classes)
Claus Gittinger <cg@exept.de>
parents: 11068
diff changeset
  4176
e5bd3a66ca80 conversion errors (specific error classes)
Claus Gittinger <cg@exept.de>
parents: 11068
diff changeset
  4177
    ^ self class conversionErrorSignal
e5bd3a66ca80 conversion errors (specific error classes)
Claus Gittinger <cg@exept.de>
parents: 11068
diff changeset
  4178
!
e5bd3a66ca80 conversion errors (specific error classes)
Claus Gittinger <cg@exept.de>
parents: 11068
diff changeset
  4179
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4180
doesNotUnderstand:aMessage
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4181
    "this message is sent by the runtime system (VM) when
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4182
     a message is not understood by some object (i.e. there
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4183
     is no method for that selector). The original message has
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4184
     been packed into aMessage (i.e. the receiver, selector and
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4185
     any arguments) and the original receiver is then sent the
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4186
     #doesNotUnderstand: message.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4187
     Here, we raise another signal which usually enters the debugger.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4188
     You can of course redefine #doesNotUnderstand: in your classes
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  4189
     to implement message delegation,
8500
10d47cede03c Speed up MessageNotUnderstood exception sending by layz computation
Stefan Vogel <sv@exept.de>
parents: 8481
diff changeset
  4190
     or handle the MessageNotUnderstood exception gracefully."
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4191
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4192
    <context: #return>
11021
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4193
    <resource: #skipInDebuggersWalkBack>
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4194
8500
10d47cede03c Speed up MessageNotUnderstood exception sending by layz computation
Stefan Vogel <sv@exept.de>
parents: 8481
diff changeset
  4195
    ^ MessageNotUnderstood raiseRequestWith:aMessage
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4196
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4197
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4198
elementBoundsError
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4199
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4200
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  4201
    "report an error that badElement is out of bounds
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4202
     (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
  4203
     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
  4204
11021
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4205
    <resource: #skipInDebuggersWalkBack>
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4206
8330
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
  4207
    ^ ElementBoundsError raise
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4208
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4209
    "Modified: 8.5.1996 / 09:12:45 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4210
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4211
7215
733294e1a8cc correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 7211
diff changeset
  4212
elementBoundsError:aValue
733294e1a8cc correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 7211
diff changeset
  4213
    "{ Pragma: +optSpace }"
733294e1a8cc correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 7211
diff changeset
  4214
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  4215
    "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
  4216
     (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
  4217
     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
  4218
11021
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4219
    <resource: #skipInDebuggersWalkBack>
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4220
8330
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
  4221
    ^ ElementBoundsError raiseWith:aValue
7215
733294e1a8cc correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 7211
diff changeset
  4222
733294e1a8cc correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 7211
diff changeset
  4223
    "Modified: 8.5.1996 / 09:12:45 / cg"
733294e1a8cc correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 7211
diff changeset
  4224
!
733294e1a8cc correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 7211
diff changeset
  4225
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4226
elementNotCharacter
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4227
    "{ Pragma: +optSpace }"
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
    "report an error that object to be stored is no Character.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4230
     (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
  4231
     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
  4232
11021
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4233
    <resource: #skipInDebuggersWalkBack>
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4234
8330
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
  4235
    ^ ElementBoundsError raise
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4236
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4237
    "Modified: 8.5.1996 / 09:12:49 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4238
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4239
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4240
elementNotInteger
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4241
    "{ Pragma: +optSpace }"
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
    "report an error that object to be stored is not Integer.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4244
     (in collections that store integers only).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4245
     The error is reported by raising the ElementOutOfBoundsSignal exception."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4246
11021
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4247
    <resource: #skipInDebuggersWalkBack>
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4248
8330
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
  4249
    ^ ElementBoundsError raise
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4250
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4251
    "Modified: 8.5.1996 / 09:12:51 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4252
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4253
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4254
error
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4255
    "{ Pragma: +optSpace }"
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
    "report error that an error occured.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4258
     The error is reported by raising the Error exception,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4259
     which is non-proceedable.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4260
     If no handler has been setup, a debugger is entered."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4261
11021
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4262
    <context: #return>
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4263
    <resource: #skipInDebuggersWalkBack>
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4264
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4265
    Error raiseWith:#error:
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4266
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4267
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4268
     nil error
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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4271
    "Modified: / 8.5.1996 / 09:13:01 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4272
    "Modified: / 2.8.1999 / 17:00:19 / stefan"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4273
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4274
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4275
error:aString
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4276
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4277
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4278
    "Raise an error with error message aString.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4279
     The error is reported by raising the Error exception,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4280
     which is non-proceedable.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4281
     If no handler has been setup, a debugger is entered."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4282
11021
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4283
    <context: #return>
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4284
    <resource: #skipInDebuggersWalkBack>
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4285
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  4286
    Error raiseWith:#error: errorString:aString
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4287
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4288
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4289
      nil error:' bad bad bad'
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4290
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4291
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4292
    "Modified: 8.5.1996 / 09:13:04 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4293
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4294
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4295
error:aString mayProceed:mayProceed
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4296
    "{ Pragma: +optSpace }"
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
    "enter debugger with error-message aString.
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  4299
     The error is reported by raising either the
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4300
     non-proceedable Error exception,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4301
     or the ProceedableError exception."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4302
11021
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4303
    <resource: #skipInDebuggersWalkBack>
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4304
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4305
    mayProceed ifTrue:[
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  4306
        ^ ProceedableError raiseRequestWith:#error: errorString:aString
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  4307
    ].
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  4308
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  4309
    Error raiseWith:#error: errorString:aString
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4310
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4311
    "Modified: 8.5.1996 / 09:13:04 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4312
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4313
6900
3b1eafe032b2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6884
diff changeset
  4314
errorInvalidFormat
3b1eafe032b2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6884
diff changeset
  4315
    "{ Pragma: +optSpace }"
3b1eafe032b2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6884
diff changeset
  4316
3b1eafe032b2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6884
diff changeset
  4317
    "report an error that some conversion to/from string representation failed
3b1eafe032b2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6884
diff changeset
  4318
     typically when converting numbers, date, time etc."
3b1eafe032b2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6884
diff changeset
  4319
11021
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4320
    <context: #return>
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4321
    <resource: #skipInDebuggersWalkBack>
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4322
6900
3b1eafe032b2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6884
diff changeset
  4323
    ^ ConversionError raiseErrorString:'invalid format'
3b1eafe032b2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6884
diff changeset
  4324
!
3b1eafe032b2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6884
diff changeset
  4325
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4326
errorKeyNotFound:aKey
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4327
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4328
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4329
    "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
  4330
     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
  4331
11021
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4332
    <resource: #skipInDebuggersWalkBack>
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4333
10918
a4635305501e #instVarNamed* - raise KeyNotFoundError if an instaver does not exist
Stefan Vogel <sv@exept.de>
parents: 10877
diff changeset
  4334
    ^ 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
  4335
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
  4336
    "
18685
8cce79003d52 class: Object
Claus Gittinger <cg@exept.de>
parents: 18620
diff changeset
  4337
     Dictionary new at:#nonExistentElement
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4338
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4339
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4340
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4341
errorNotFound
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4342
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4343
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4344
    "report an error that no element was found in a collection.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4345
     The error is reported by raising the NotFoundSignal exception."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4346
11021
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4347
    <resource: #skipInDebuggersWalkBack>
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4348
6946
905fcfc8699b signal-classVars replaced by error-class access
Claus Gittinger <cg@exept.de>
parents: 6932
diff changeset
  4349
    ^ NotFoundError raiseRequestWith:nil
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4350
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4351
    "Modified: / 8.5.1996 / 09:13:11 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4352
    "Modified: / 26.7.1999 / 10:51:50 / stefan"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4353
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4354
6874
c539a4c44df1 +errorNotFound:
Claus Gittinger <cg@exept.de>
parents: 6845
diff changeset
  4355
errorNotFound:errorString
c539a4c44df1 +errorNotFound:
Claus Gittinger <cg@exept.de>
parents: 6845
diff changeset
  4356
    "{ Pragma: +optSpace }"
c539a4c44df1 +errorNotFound:
Claus Gittinger <cg@exept.de>
parents: 6845
diff changeset
  4357
c539a4c44df1 +errorNotFound:
Claus Gittinger <cg@exept.de>
parents: 6845
diff changeset
  4358
    "report an error that no element was found in a collection.
c539a4c44df1 +errorNotFound:
Claus Gittinger <cg@exept.de>
parents: 6845
diff changeset
  4359
     The error is reported by raising the NotFoundSignal exception."
c539a4c44df1 +errorNotFound:
Claus Gittinger <cg@exept.de>
parents: 6845
diff changeset
  4360
11021
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4361
    <resource: #skipInDebuggersWalkBack>
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4362
10837
63d19c75d762 changed #errorNotFound: raise it proceedable
Stefan Vogel <sv@exept.de>
parents: 10834
diff changeset
  4363
    ^ NotFoundError raiseRequestErrorString:errorString
6874
c539a4c44df1 +errorNotFound:
Claus Gittinger <cg@exept.de>
parents: 6845
diff changeset
  4364
!
c539a4c44df1 +errorNotFound:
Claus Gittinger <cg@exept.de>
parents: 6845
diff changeset
  4365
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4366
errorSignal
11132
e5bd3a66ca80 conversion errors (specific error classes)
Claus Gittinger <cg@exept.de>
parents: 11068
diff changeset
  4367
    "return the signal used for error/error: handling"
e5bd3a66ca80 conversion errors (specific error classes)
Claus Gittinger <cg@exept.de>
parents: 11068
diff changeset
  4368
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4369
    ^ self class errorSignal
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4370
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4371
    "Created: / 19.6.1998 / 02:32:32 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4372
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4373
7322
178e33c2a376 catch non-block/non-signal/non-exception being
Claus Gittinger <cg@exept.de>
parents: 7320
diff changeset
  4374
handlerForSignal:exceptionHandler context:theContext originator:originator
178e33c2a376 catch non-block/non-signal/non-exception being
Claus Gittinger <cg@exept.de>
parents: 7320
diff changeset
  4375
    " 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
  4376
7566
f691eac0f114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7562
diff changeset
  4377
    thisContext isRecursive ifTrue:[^ nil].
f691eac0f114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7562
diff changeset
  4378
7322
178e33c2a376 catch non-block/non-signal/non-exception being
Claus Gittinger <cg@exept.de>
parents: 7320
diff changeset
  4379
    '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
  4380
    '         context: ' print. theContext printCR.
178e33c2a376 catch non-block/non-signal/non-exception being
Claus Gittinger <cg@exept.de>
parents: 7320
diff changeset
  4381
    '         originator: ' print. originator printCR.
178e33c2a376 catch non-block/non-signal/non-exception being
Claus Gittinger <cg@exept.de>
parents: 7320
diff changeset
  4382
    '         sender: ' print. thisContext sender printCR.
178e33c2a376 catch non-block/non-signal/non-exception being
Claus Gittinger <cg@exept.de>
parents: 7320
diff changeset
  4383
7566
f691eac0f114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7562
diff changeset
  4384
    "/ MiniDebugger enter:thisContext withMessage:'oops' mayProceed:true.
f691eac0f114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7562
diff changeset
  4385
    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
  4386
!
178e33c2a376 catch non-block/non-signal/non-exception being
Claus Gittinger <cg@exept.de>
parents: 7320
diff changeset
  4387
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4388
implementedBySubclass
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4389
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4390
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4391
    "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
  4392
11021
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4393
    <resource: #skipInDebuggersWalkBack>
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4394
12322
a8a569a96301 changed:
Claus Gittinger <cg@exept.de>
parents: 12321
diff changeset
  4395
    ^ SubclassResponsibilityError raiseRequestErrorString:'method must be reimplemented in ST/V subclass'
5755
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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4398
indexNotInteger
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4399
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4400
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4401
    "report an error that index is not an Integer.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4402
     (when accessing collections indexed by an integer key).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4403
     The error is reported by raising the NonIntegerIndexSignal exception."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4404
11021
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4405
    <resource: #skipInDebuggersWalkBack>
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4406
6946
905fcfc8699b signal-classVars replaced by error-class access
Claus Gittinger <cg@exept.de>
parents: 6932
diff changeset
  4407
    ^ NonIntegerIndexError raiseRequestWith:nil
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
    "Modified: / 8.5.1996 / 09:13:37 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4410
    "Modified: / 26.7.1999 / 10:57:43 / stefan"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4411
!
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
indexNotInteger:anIndex
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4414
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4415
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4416
    "report an error that index is not an Integer.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4417
     (when accessing collections indexed by an integer key).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4418
     The error is reported by raising the NonIntegerIndexSignal exception."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4419
11021
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4420
    <resource: #skipInDebuggersWalkBack>
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4421
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  4422
    ^ NonIntegerIndexError raiseRequestWith:anIndex
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4423
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4424
    "Created: / 16.5.1998 / 19:39:41 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4425
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4426
7216
59bfa2ffdcf7 utility
Claus Gittinger <cg@exept.de>
parents: 7215
diff changeset
  4427
indexNotIntegerOrOutOfBounds:index
59bfa2ffdcf7 utility
Claus Gittinger <cg@exept.de>
parents: 7215
diff changeset
  4428
    "{ Pragma: +optSpace }"
59bfa2ffdcf7 utility
Claus Gittinger <cg@exept.de>
parents: 7215
diff changeset
  4429
59bfa2ffdcf7 utility
Claus Gittinger <cg@exept.de>
parents: 7215
diff changeset
  4430
    "report an error that index is either non-integral or out of bounds"
59bfa2ffdcf7 utility
Claus Gittinger <cg@exept.de>
parents: 7215
diff changeset
  4431
11021
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4432
    <resource: #skipInDebuggersWalkBack>
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4433
7216
59bfa2ffdcf7 utility
Claus Gittinger <cg@exept.de>
parents: 7215
diff changeset
  4434
    index isInteger ifFalse:[
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  4435
        ^ self indexNotInteger:index
7216
59bfa2ffdcf7 utility
Claus Gittinger <cg@exept.de>
parents: 7215
diff changeset
  4436
    ].
59bfa2ffdcf7 utility
Claus Gittinger <cg@exept.de>
parents: 7215
diff changeset
  4437
    ^ self subscriptBoundsError:index
59bfa2ffdcf7 utility
Claus Gittinger <cg@exept.de>
parents: 7215
diff changeset
  4438
!
59bfa2ffdcf7 utility
Claus Gittinger <cg@exept.de>
parents: 7215
diff changeset
  4439
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4440
integerCheckError
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4441
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4442
12321
ff74d7eab313 added: #shouldImplement:
Claus Gittinger <cg@exept.de>
parents: 12288
diff changeset
  4443
    "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
  4444
11021
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4445
    <resource: #skipInDebuggersWalkBack>
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4446
14478
4ff5aab56d26 more specific error reporting for type errors
Claus Gittinger <cg@exept.de>
parents: 14369
diff changeset
  4447
"/    ^ self error:'bad assign of ' , self printString ,
4ff5aab56d26 more specific error reporting for type errors
Claus Gittinger <cg@exept.de>
parents: 14369
diff changeset
  4448
"/                  ' (' , self class name , ') to integer-typed variable'
14632
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14539
diff changeset
  4449
    ^ InvalidTypeError
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  4450
        raiseRequestErrorString:(
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  4451
            'bad assign of ' , self printString ,
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  4452
                  ' (' , self class name , ') to integer-typed variable')
14478
4ff5aab56d26 more specific error reporting for type errors
Claus Gittinger <cg@exept.de>
parents: 14369
diff changeset
  4453
4ff5aab56d26 more specific error reporting for type errors
Claus Gittinger <cg@exept.de>
parents: 14369
diff changeset
  4454
    "Modified: / 02-11-2012 / 10:25:36 / cg"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4455
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4456
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4457
invalidCodeObject
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4458
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4459
12321
ff74d7eab313 added: #shouldImplement:
Claus Gittinger <cg@exept.de>
parents: 12288
diff changeset
  4460
    "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
  4461
11021
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4462
    <resource: #skipInDebuggersWalkBack>
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4463
14478
4ff5aab56d26 more specific error reporting for type errors
Claus Gittinger <cg@exept.de>
parents: 14369
diff changeset
  4464
    "/ self error:'not an executable code object'
14632
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14539
diff changeset
  4465
    ^ ExecutionError
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  4466
        raiseRequestErrorString:'not an executable code object'
14478
4ff5aab56d26 more specific error reporting for type errors
Claus Gittinger <cg@exept.de>
parents: 14369
diff changeset
  4467
4ff5aab56d26 more specific error reporting for type errors
Claus Gittinger <cg@exept.de>
parents: 14369
diff changeset
  4468
    "Created: / 01-08-1997 / 00:16:44 / cg"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4469
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4470
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  4471
invalidMessage
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4472
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4473
14478
4ff5aab56d26 more specific error reporting for type errors
Claus Gittinger <cg@exept.de>
parents: 14369
diff changeset
  4474
    "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
  4475
11021
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4476
    <resource: #skipInDebuggersWalkBack>
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4477
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4478
    ^ self shouldNotImplement
14478
4ff5aab56d26 more specific error reporting for type errors
Claus Gittinger <cg@exept.de>
parents: 14369
diff changeset
  4479
4ff5aab56d26 more specific error reporting for type errors
Claus Gittinger <cg@exept.de>
parents: 14369
diff changeset
  4480
    "Modified (comment): / 02-11-2012 / 10:11:18 / cg"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4481
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4482
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4483
mustBeRectangle
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4484
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4485
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4486
    "report an argument-not-rectangle-error"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4487
11021
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4488
    <resource: #skipInDebuggersWalkBack>
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4489
14478
4ff5aab56d26 more specific error reporting for type errors
Claus Gittinger <cg@exept.de>
parents: 14369
diff changeset
  4490
    "/ ^ self error:'argument must be a Rectangle'
4ff5aab56d26 more specific error reporting for type errors
Claus Gittinger <cg@exept.de>
parents: 14369
diff changeset
  4491
    ^ InvalidTypeError
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  4492
        raiseRequestErrorString:'argument must be a Rectangle'
14478
4ff5aab56d26 more specific error reporting for type errors
Claus Gittinger <cg@exept.de>
parents: 14369
diff changeset
  4493
4ff5aab56d26 more specific error reporting for type errors
Claus Gittinger <cg@exept.de>
parents: 14369
diff changeset
  4494
    "Modified: / 02-11-2012 / 10:24:53 / cg"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4495
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4496
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4497
mustBeString
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4498
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4499
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4500
    "report an argument-not-string-error"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4501
11021
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4502
    <resource: #skipInDebuggersWalkBack>
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4503
14478
4ff5aab56d26 more specific error reporting for type errors
Claus Gittinger <cg@exept.de>
parents: 14369
diff changeset
  4504
    "/ ^ self error:'argument must be a String'
4ff5aab56d26 more specific error reporting for type errors
Claus Gittinger <cg@exept.de>
parents: 14369
diff changeset
  4505
    ^ InvalidTypeError
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  4506
        raiseRequestErrorString:'argument must be a String'
14478
4ff5aab56d26 more specific error reporting for type errors
Claus Gittinger <cg@exept.de>
parents: 14369
diff changeset
  4507
4ff5aab56d26 more specific error reporting for type errors
Claus Gittinger <cg@exept.de>
parents: 14369
diff changeset
  4508
    "Modified: / 02-11-2012 / 10:24:35 / cg"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4509
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4510
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4511
notIndexed
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4512
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4513
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4514
    "report an error that receiver has no indexed instance variables.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4515
     The error is reported by raising the SubscriptOutOfBoundsSignal exception."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4516
11021
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4517
    <context: #return>
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4518
    <resource: #skipInDebuggersWalkBack>
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4519
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  4520
    ^ SubscriptOutOfBoundsError
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  4521
        raiseRequestErrorString:'receiver has no indexed variables'
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4522
14539
9cc7e1ad8b52 class: Object
Claus Gittinger <cg@exept.de>
parents: 14534
diff changeset
  4523
    "
9cc7e1ad8b52 class: Object
Claus Gittinger <cg@exept.de>
parents: 14534
diff changeset
  4524
     1234 at:4
9cc7e1ad8b52 class: Object
Claus Gittinger <cg@exept.de>
parents: 14534
diff changeset
  4525
    "
9cc7e1ad8b52 class: Object
Claus Gittinger <cg@exept.de>
parents: 14534
diff changeset
  4526
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4527
    "Modified: 26.7.1996 / 16:43:13 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4528
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4529
12050
bd0013f79e4f added: #notYetImplemented
Claus Gittinger <cg@exept.de>
parents: 11976
diff changeset
  4530
notYetImplemented
bd0013f79e4f added: #notYetImplemented
Claus Gittinger <cg@exept.de>
parents: 11976
diff changeset
  4531
    "{ Pragma: +optSpace }"
bd0013f79e4f added: #notYetImplemented
Claus Gittinger <cg@exept.de>
parents: 11976
diff changeset
  4532
12321
ff74d7eab313 added: #shouldImplement:
Claus Gittinger <cg@exept.de>
parents: 12288
diff changeset
  4533
    "report an error that some functionality is not yet implemented.
ff74d7eab313 added: #shouldImplement:
Claus Gittinger <cg@exept.de>
parents: 12288
diff changeset
  4534
     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
  4535
bd0013f79e4f added: #notYetImplemented
Claus Gittinger <cg@exept.de>
parents: 11976
diff changeset
  4536
    <resource: #skipInDebuggersWalkBack>
bd0013f79e4f added: #notYetImplemented
Claus Gittinger <cg@exept.de>
parents: 11976
diff changeset
  4537
15891
22552f0cd4e4 class: Object
Stefan Vogel <sv@exept.de>
parents: 15854
diff changeset
  4538
    |sender|
22552f0cd4e4 class: Object
Stefan Vogel <sv@exept.de>
parents: 15854
diff changeset
  4539
22552f0cd4e4 class: Object
Stefan Vogel <sv@exept.de>
parents: 15854
diff changeset
  4540
    sender := thisContext sender.
22552f0cd4e4 class: Object
Stefan Vogel <sv@exept.de>
parents: 15854
diff changeset
  4541
22552f0cd4e4 class: Object
Stefan Vogel <sv@exept.de>
parents: 15854
diff changeset
  4542
    ^ UnimplementedFunctionalityError
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  4543
        raiseRequestWith:(Message selector:sender selector arguments:sender args)
14478
4ff5aab56d26 more specific error reporting for type errors
Claus Gittinger <cg@exept.de>
parents: 14369
diff changeset
  4544
4ff5aab56d26 more specific error reporting for type errors
Claus Gittinger <cg@exept.de>
parents: 14369
diff changeset
  4545
    "Modified: / 02-11-2012 / 10:24:12 / cg"
12050
bd0013f79e4f added: #notYetImplemented
Claus Gittinger <cg@exept.de>
parents: 11976
diff changeset
  4546
!
bd0013f79e4f added: #notYetImplemented
Claus Gittinger <cg@exept.de>
parents: 11976
diff changeset
  4547
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4548
primitiveFailed
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4549
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4550
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4551
    "report an error that some primitive code failed.
14539
9cc7e1ad8b52 class: Object
Claus Gittinger <cg@exept.de>
parents: 14534
diff changeset
  4552
     The error is reported by raising the PrimitiveFailure exception.
9cc7e1ad8b52 class: Object
Claus Gittinger <cg@exept.de>
parents: 14534
diff changeset
  4553
     Sorry for the code duplication: it avoids the extra frame in the debugger."
8324
c6e8039f0d83 Set message as parameter in #primitiveFailed
Stefan Vogel <sv@exept.de>
parents: 8322
diff changeset
  4554
11021
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4555
    <resource: #skipInDebuggersWalkBack>
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4556
15891
22552f0cd4e4 class: Object
Stefan Vogel <sv@exept.de>
parents: 15854
diff changeset
  4557
    |sender selector|
22552f0cd4e4 class: Object
Stefan Vogel <sv@exept.de>
parents: 15854
diff changeset
  4558
22552f0cd4e4 class: Object
Stefan Vogel <sv@exept.de>
parents: 15854
diff changeset
  4559
    "do loop to take care of super sends"
8324
c6e8039f0d83 Set message as parameter in #primitiveFailed
Stefan Vogel <sv@exept.de>
parents: 8322
diff changeset
  4560
    sender := thisContext sender.
15891
22552f0cd4e4 class: Object
Stefan Vogel <sv@exept.de>
parents: 15854
diff changeset
  4561
    [
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  4562
        selector := sender selector.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  4563
        selector == #primitiveFailed: or:[selector == #primitiveFailed]
15891
22552f0cd4e4 class: Object
Stefan Vogel <sv@exept.de>
parents: 15854
diff changeset
  4564
    ] whileTrue:[sender := sender sender].
22552f0cd4e4 class: Object
Stefan Vogel <sv@exept.de>
parents: 15854
diff changeset
  4565
22552f0cd4e4 class: Object
Stefan Vogel <sv@exept.de>
parents: 15854
diff changeset
  4566
    ^ PrimitiveFailure raiseRequestWith:(Message selector:selector arguments:sender args)
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  4567
                       in:sender.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4568
6005
012813d02bf7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6000
diff changeset
  4569
    "
012813d02bf7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6000
diff changeset
  4570
     1234 primitiveFailed
8324
c6e8039f0d83 Set message as parameter in #primitiveFailed
Stefan Vogel <sv@exept.de>
parents: 8322
diff changeset
  4571
c6e8039f0d83 Set message as parameter in #primitiveFailed
Stefan Vogel <sv@exept.de>
parents: 8322
diff changeset
  4572
     [
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  4573
        ExternalBytes new   basicAt:40
8324
c6e8039f0d83 Set message as parameter in #primitiveFailed
Stefan Vogel <sv@exept.de>
parents: 8322
diff changeset
  4574
     ] on:PrimitiveFailure do:[:ex|
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  4575
        ex inspect
8324
c6e8039f0d83 Set message as parameter in #primitiveFailed
Stefan Vogel <sv@exept.de>
parents: 8322
diff changeset
  4576
     ]
c6e8039f0d83 Set message as parameter in #primitiveFailed
Stefan Vogel <sv@exept.de>
parents: 8322
diff changeset
  4577
    "
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4578
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4579
8977
fff5644c031d #primitiveFailed: remember the message implementing the failure
Stefan Vogel <sv@exept.de>
parents: 8975
diff changeset
  4580
primitiveFailed:messageString
fff5644c031d #primitiveFailed: remember the message implementing the failure
Stefan Vogel <sv@exept.de>
parents: 8975
diff changeset
  4581
    "{ Pragma: +optSpace }"
fff5644c031d #primitiveFailed: remember the message implementing the failure
Stefan Vogel <sv@exept.de>
parents: 8975
diff changeset
  4582
fff5644c031d #primitiveFailed: remember the message implementing the failure
Stefan Vogel <sv@exept.de>
parents: 8975
diff changeset
  4583
    "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
  4584
     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
  4585
11021
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4586
    <resource: #skipInDebuggersWalkBack>
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4587
15891
22552f0cd4e4 class: Object
Stefan Vogel <sv@exept.de>
parents: 15854
diff changeset
  4588
    |sender selector|
22552f0cd4e4 class: Object
Stefan Vogel <sv@exept.de>
parents: 15854
diff changeset
  4589
22552f0cd4e4 class: Object
Stefan Vogel <sv@exept.de>
parents: 15854
diff changeset
  4590
    "do loop to take care of super sends"
8977
fff5644c031d #primitiveFailed: remember the message implementing the failure
Stefan Vogel <sv@exept.de>
parents: 8975
diff changeset
  4591
    sender := thisContext sender.
15891
22552f0cd4e4 class: Object
Stefan Vogel <sv@exept.de>
parents: 15854
diff changeset
  4592
    [
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  4593
        selector := sender selector.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  4594
        selector == #primitiveFailed: or:[selector == #primitiveFailed]
15891
22552f0cd4e4 class: Object
Stefan Vogel <sv@exept.de>
parents: 15854
diff changeset
  4595
    ] whileTrue:[sender := sender sender].
22552f0cd4e4 class: Object
Stefan Vogel <sv@exept.de>
parents: 15854
diff changeset
  4596
22552f0cd4e4 class: Object
Stefan Vogel <sv@exept.de>
parents: 15854
diff changeset
  4597
    ^ PrimitiveFailure raiseRequestWith:(Message selector:selector arguments:sender args)
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  4598
                       errorString:messageString
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  4599
                       in:sender.
8977
fff5644c031d #primitiveFailed: remember the message implementing the failure
Stefan Vogel <sv@exept.de>
parents: 8975
diff changeset
  4600
fff5644c031d #primitiveFailed: remember the message implementing the failure
Stefan Vogel <sv@exept.de>
parents: 8975
diff changeset
  4601
    "
fff5644c031d #primitiveFailed: remember the message implementing the failure
Stefan Vogel <sv@exept.de>
parents: 8975
diff changeset
  4602
     1234 primitiveFailed:'this is a test'
fff5644c031d #primitiveFailed: remember the message implementing the failure
Stefan Vogel <sv@exept.de>
parents: 8975
diff changeset
  4603
    "
fff5644c031d #primitiveFailed: remember the message implementing the failure
Stefan Vogel <sv@exept.de>
parents: 8975
diff changeset
  4604
!
fff5644c031d #primitiveFailed: remember the message implementing the failure
Stefan Vogel <sv@exept.de>
parents: 8975
diff changeset
  4605
6815
71582d439a74 Define #shouldImplement
Stefan Vogel <sv@exept.de>
parents: 6805
diff changeset
  4606
shouldImplement
71582d439a74 Define #shouldImplement
Stefan Vogel <sv@exept.de>
parents: 6805
diff changeset
  4607
    "{ Pragma: +optSpace }"
71582d439a74 Define #shouldImplement
Stefan Vogel <sv@exept.de>
parents: 6805
diff changeset
  4608
12321
ff74d7eab313 added: #shouldImplement:
Claus Gittinger <cg@exept.de>
parents: 12288
diff changeset
  4609
    "report an error that this message/functionality should be implemented.
ff74d7eab313 added: #shouldImplement:
Claus Gittinger <cg@exept.de>
parents: 12288
diff changeset
  4610
     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
  4611
     branches of existing methods."
6815
71582d439a74 Define #shouldImplement
Stefan Vogel <sv@exept.de>
parents: 6805
diff changeset
  4612
11021
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4613
    <resource: #skipInDebuggersWalkBack>
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4614
9216
6396192d71c6 use UnimplementedFunctionalityError in #subclassResponsibility
Stefan Vogel <sv@exept.de>
parents: 9203
diff changeset
  4615
    |sender|
6396192d71c6 use UnimplementedFunctionalityError in #subclassResponsibility
Stefan Vogel <sv@exept.de>
parents: 9203
diff changeset
  4616
6396192d71c6 use UnimplementedFunctionalityError in #subclassResponsibility
Stefan Vogel <sv@exept.de>
parents: 9203
diff changeset
  4617
    sender := thisContext sender.
6396192d71c6 use UnimplementedFunctionalityError in #subclassResponsibility
Stefan Vogel <sv@exept.de>
parents: 9203
diff changeset
  4618
12841
d804b0f27fe7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12733
diff changeset
  4619
    ^ UnimplementedFunctionalityError
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  4620
        raiseRequestWith:(Message selector:sender selector arguments:sender args)
9216
6396192d71c6 use UnimplementedFunctionalityError in #subclassResponsibility
Stefan Vogel <sv@exept.de>
parents: 9203
diff changeset
  4621
6396192d71c6 use UnimplementedFunctionalityError in #subclassResponsibility
Stefan Vogel <sv@exept.de>
parents: 9203
diff changeset
  4622
     "
12321
ff74d7eab313 added: #shouldImplement:
Claus Gittinger <cg@exept.de>
parents: 12288
diff changeset
  4623
      self shouldImplement
ff74d7eab313 added: #shouldImplement:
Claus Gittinger <cg@exept.de>
parents: 12288
diff changeset
  4624
     "
ff74d7eab313 added: #shouldImplement:
Claus Gittinger <cg@exept.de>
parents: 12288
diff changeset
  4625
!
ff74d7eab313 added: #shouldImplement:
Claus Gittinger <cg@exept.de>
parents: 12288
diff changeset
  4626
ff74d7eab313 added: #shouldImplement:
Claus Gittinger <cg@exept.de>
parents: 12288
diff changeset
  4627
shouldImplement:what
ff74d7eab313 added: #shouldImplement:
Claus Gittinger <cg@exept.de>
parents: 12288
diff changeset
  4628
    "{ Pragma: +optSpace }"
ff74d7eab313 added: #shouldImplement:
Claus Gittinger <cg@exept.de>
parents: 12288
diff changeset
  4629
ff74d7eab313 added: #shouldImplement:
Claus Gittinger <cg@exept.de>
parents: 12288
diff changeset
  4630
    "report an error that this message/functionality should be implemented.
ff74d7eab313 added: #shouldImplement:
Claus Gittinger <cg@exept.de>
parents: 12288
diff changeset
  4631
     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
  4632
     branches of existing methods."
ff74d7eab313 added: #shouldImplement:
Claus Gittinger <cg@exept.de>
parents: 12288
diff changeset
  4633
ff74d7eab313 added: #shouldImplement:
Claus Gittinger <cg@exept.de>
parents: 12288
diff changeset
  4634
    <resource: #skipInDebuggersWalkBack>
ff74d7eab313 added: #shouldImplement:
Claus Gittinger <cg@exept.de>
parents: 12288
diff changeset
  4635
ff74d7eab313 added: #shouldImplement:
Claus Gittinger <cg@exept.de>
parents: 12288
diff changeset
  4636
    |sender|
ff74d7eab313 added: #shouldImplement:
Claus Gittinger <cg@exept.de>
parents: 12288
diff changeset
  4637
ff74d7eab313 added: #shouldImplement:
Claus Gittinger <cg@exept.de>
parents: 12288
diff changeset
  4638
    sender := thisContext sender.
ff74d7eab313 added: #shouldImplement:
Claus Gittinger <cg@exept.de>
parents: 12288
diff changeset
  4639
12841
d804b0f27fe7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12733
diff changeset
  4640
    ^ UnimplementedFunctionalityError
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  4641
        raiseRequestWith:(Message selector:sender selector arguments:sender args)
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  4642
        errorString:what
12321
ff74d7eab313 added: #shouldImplement:
Claus Gittinger <cg@exept.de>
parents: 12288
diff changeset
  4643
ff74d7eab313 added: #shouldImplement:
Claus Gittinger <cg@exept.de>
parents: 12288
diff changeset
  4644
     "
ff74d7eab313 added: #shouldImplement:
Claus Gittinger <cg@exept.de>
parents: 12288
diff changeset
  4645
      self shouldImplement:'foobar'
9216
6396192d71c6 use UnimplementedFunctionalityError in #subclassResponsibility
Stefan Vogel <sv@exept.de>
parents: 9203
diff changeset
  4646
     "
6815
71582d439a74 Define #shouldImplement
Stefan Vogel <sv@exept.de>
parents: 6805
diff changeset
  4647
!
71582d439a74 Define #shouldImplement
Stefan Vogel <sv@exept.de>
parents: 6805
diff changeset
  4648
11976
2c8e5e4f97f4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11790
diff changeset
  4649
shouldNeverBeReached
12321
ff74d7eab313 added: #shouldImplement:
Claus Gittinger <cg@exept.de>
parents: 12288
diff changeset
  4650
    "report an error that this point may never be reached."
12841
d804b0f27fe7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12733
diff changeset
  4651
14499
6ed948158d25 class: Object
Claus Gittinger <cg@exept.de>
parents: 14478
diff changeset
  4652
    <resource: #skipInDebuggersWalkBack>
6ed948158d25 class: Object
Claus Gittinger <cg@exept.de>
parents: 14478
diff changeset
  4653
6ed948158d25 class: Object
Claus Gittinger <cg@exept.de>
parents: 14478
diff changeset
  4654
    ^ ExecutionError
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  4655
        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
  4656
2c8e5e4f97f4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11790
diff changeset
  4657
    "Modified: / 20-04-2005 / 18:59:28 / janfrog"
2c8e5e4f97f4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11790
diff changeset
  4658
!
2c8e5e4f97f4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11790
diff changeset
  4659
2c8e5e4f97f4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11790
diff changeset
  4660
shouldNeverBeSent
12321
ff74d7eab313 added: #shouldImplement:
Claus Gittinger <cg@exept.de>
parents: 12288
diff changeset
  4661
    "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
  4662
14499
6ed948158d25 class: Object
Claus Gittinger <cg@exept.de>
parents: 14478
diff changeset
  4663
    <resource: #skipInDebuggersWalkBack>
6ed948158d25 class: Object
Claus Gittinger <cg@exept.de>
parents: 14478
diff changeset
  4664
14632
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14539
diff changeset
  4665
    ^ MethodNotAppropriateError
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  4666
        raiseRequestErrorString:'This message never may be sent to me'.
11976
2c8e5e4f97f4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11790
diff changeset
  4667
2c8e5e4f97f4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11790
diff changeset
  4668
    "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
  4669
    "Modified: / 02-11-2012 / 10:10:42 / cg"
11976
2c8e5e4f97f4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11790
diff changeset
  4670
!
2c8e5e4f97f4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11790
diff changeset
  4671
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4672
shouldNotImplement
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4673
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4674
12841
d804b0f27fe7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12733
diff changeset
  4675
    "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
  4676
     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
  4677
11021
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4678
    <resource: #skipInDebuggersWalkBack>
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4679
14632
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14539
diff changeset
  4680
    ^ MethodNotAppropriateError
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  4681
        raiseRequestErrorString:'method/functionality is not appropriate for class'.
14478
4ff5aab56d26 more specific error reporting for type errors
Claus Gittinger <cg@exept.de>
parents: 14369
diff changeset
  4682
4ff5aab56d26 more specific error reporting for type errors
Claus Gittinger <cg@exept.de>
parents: 14369
diff changeset
  4683
    "Modified: / 02-11-2012 / 10:02:25 / cg"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4684
!
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
subclassResponsibility
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4687
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4688
12321
ff74d7eab313 added: #shouldImplement:
Claus Gittinger <cg@exept.de>
parents: 12288
diff changeset
  4689
    "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
  4690
11021
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4691
    <resource: #skipInDebuggersWalkBack>
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4692
10877
0666d48f91d1 show the affected method-selector in the subclassResponsibility
Claus Gittinger <cg@exept.de>
parents: 10856
diff changeset
  4693
    ^ SubclassResponsibilityError raiseRequestWith:thisContext sender selector
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4694
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4695
6721
e5f47c6e2f40 #subclassResponsibility & #subclassResponsibility:
Claus Gittinger <cg@exept.de>
parents: 6718
diff changeset
  4696
subclassResponsibility:msg
e5f47c6e2f40 #subclassResponsibility & #subclassResponsibility:
Claus Gittinger <cg@exept.de>
parents: 6718
diff changeset
  4697
    "{ Pragma: +optSpace }"
e5f47c6e2f40 #subclassResponsibility & #subclassResponsibility:
Claus Gittinger <cg@exept.de>
parents: 6718
diff changeset
  4698
e5f47c6e2f40 #subclassResponsibility & #subclassResponsibility:
Claus Gittinger <cg@exept.de>
parents: 6718
diff changeset
  4699
    "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
  4700
11021
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4701
    <resource: #skipInDebuggersWalkBack>
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4702
7334
7da368a2f0da *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 7322
diff changeset
  4703
    ^ SubclassResponsibilityError raiseRequestErrorString:msg
6721
e5f47c6e2f40 #subclassResponsibility & #subclassResponsibility:
Claus Gittinger <cg@exept.de>
parents: 6718
diff changeset
  4704
!
e5f47c6e2f40 #subclassResponsibility & #subclassResponsibility:
Claus Gittinger <cg@exept.de>
parents: 6718
diff changeset
  4705
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4706
subscriptBoundsError
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4707
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4708
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4709
    "report an error that some index is out of bounds.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4710
     (when accessing indexable collections).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4711
     The error is reported by raising the SubscriptOutOfBoundsSignal exception."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4712
11021
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4713
    <resource: #skipInDebuggersWalkBack>
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4714
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4715
    ^ SubscriptOutOfBoundsSignal raiseRequestWith:nil
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4716
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4717
    "Modified: / 26.7.1996 / 16:45:42 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4718
    "Modified: / 26.7.1999 / 10:58:27 / stefan"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4719
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4720
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4721
subscriptBoundsError:anIndex
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4722
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4723
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4724
    "report an error that anIndex is out of bounds.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4725
     (when accessing indexable collections).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4726
     The error is reported by raising the SubscriptOutOfBoundsSignal exception."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4727
11021
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4728
    <resource: #skipInDebuggersWalkBack>
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4729
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  4730
    ^ SubscriptOutOfBoundsError
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  4731
        raiseRequestWith:anIndex
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  4732
        errorString:('subscript (' , anIndex printString , ') out of bounds')
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4733
6221
404495587300 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6203
diff changeset
  4734
    "Modified: / 17.11.2001 / 22:49:56 / cg"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4735
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4736
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4737
typeCheckError
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4738
    "{ Pragma: +optSpace }"
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
    "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
  4741
     value assigned"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4742
11021
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4743
    <resource: #skipInDebuggersWalkBack>
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4744
14478
4ff5aab56d26 more specific error reporting for type errors
Claus Gittinger <cg@exept.de>
parents: 14369
diff changeset
  4745
"/    ^ self error:'bad assign of ' , self printString ,
4ff5aab56d26 more specific error reporting for type errors
Claus Gittinger <cg@exept.de>
parents: 14369
diff changeset
  4746
"/                  ' (' , self class name , ') to typed variable'
4ff5aab56d26 more specific error reporting for type errors
Claus Gittinger <cg@exept.de>
parents: 14369
diff changeset
  4747
4ff5aab56d26 more specific error reporting for type errors
Claus Gittinger <cg@exept.de>
parents: 14369
diff changeset
  4748
    ^ InvalidTypeError
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  4749
        raiseRequestErrorString:
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  4750
            ('bad assign of ' , self printString ,
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  4751
                  ' (' , self class name , ') to typed variable')
14478
4ff5aab56d26 more specific error reporting for type errors
Claus Gittinger <cg@exept.de>
parents: 14369
diff changeset
  4752
4ff5aab56d26 more specific error reporting for type errors
Claus Gittinger <cg@exept.de>
parents: 14369
diff changeset
  4753
    "Modified: / 02-11-2012 / 10:19:15 / cg"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4754
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4755
16311
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  4756
!Object methodsFor:'error handling - debugger'!
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  4757
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  4758
addDebuggerHook:aBlock
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  4759
    "add a debugger hook. Any registered hook is evaluated with the exception as
16560
Claus Gittinger <cg@exept.de>
parents: 16470
diff changeset
  4760
     argument before a real debugger is entered.
16311
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  4761
     Hooks can be used for two purposes:
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  4762
        - record exception information in a log file
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  4763
        - filter exceptions and either decide to ignore them or to open an alternative
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  4764
          debugger (depending on the exception type, maybe)"
16311
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  4765
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  4766
    DebuggerHooks isNil ifTrue:[
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  4767
        DebuggerHooks := OrderedCollection new.
16311
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  4768
    ].
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  4769
    DebuggerHooks add:aBlock
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  4770
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  4771
    "
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  4772
     Object addDebuggerHook:[:ex | AbortSignal raise].
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  4773
     (1 / (1-1)).
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  4774
     Object removeDebuggerHook:(DebuggerHooks first).
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  4775
    "
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  4776
    "
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  4777
     Object addDebuggerHook:[:ex | Transcript showCR:ex ].
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  4778
     (1 / (1-1)).
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  4779
     Object removeDebuggerHook:(DebuggerHooks first).
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  4780
    "
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  4781
    "
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  4782
     Object addDebuggerHook:[:ex | ex suspendedContext fullPrintAllOn:Transcript ].
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  4783
     (1 / (1-1)).
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  4784
     Object removeDebuggerHook:(DebuggerHooks first).
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  4785
    "
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  4786
    "
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  4787
     Object addDebuggerHook:[:ex | '/tmp/stx.log' asFilename
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  4788
                                   appendingFileDo:[:s |
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  4789
                                        s nextPutLine:'----------------------'.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  4790
                                        (Timestamp now printOn:s). s cr.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  4791
                                        ex suspendedContext fullPrintAllOn:s
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  4792
                                   ]].
16311
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  4793
     (1 / (1-1)).
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  4794
     Object removeDebuggerHook:(DebuggerHooks first).
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  4795
    "
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  4796
!
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  4797
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  4798
appropriateDebugger:aSelector
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  4799
    "{ Pragma: +optSpace }"
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  4800
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  4801
    "return an appropriate debugger to use.
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  4802
     If there is already a debugger active on the stack, and it is
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  4803
     the DebugView, return MiniDebugger (as a last chance) otherwise abort."
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  4804
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  4805
    |context|
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  4806
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  4807
    "DebugView cannot run without system processes"
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  4808
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  4809
    (Processor isNil
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  4810
    or:[Processor activeProcessIsSystemProcess
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  4811
    or:[Smalltalk isInitialized not]]) ifTrue:[
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  4812
        ^ MiniDebugger
16311
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  4813
    ].
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  4814
    (Screen isNil or:[Screen default isNil or:[Screen default isOpen not]]) ifTrue:[
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  4815
        Debugger isNil ifTrue:[^ nil].
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  4816
        ^ MiniDebugger
16311
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  4817
    ].
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  4818
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  4819
    context := thisContext.
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  4820
    context := context findNextContextWithSelector:aSelector or:nil or:nil.
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  4821
    [context notNil] whileTrue:[
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  4822
        ((context receiver class == Debugger)
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  4823
         and:[context selector == aSelector]) ifTrue:[
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  4824
            "we are already in some Debugger"
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  4825
            (Debugger == MiniDebugger) ifTrue:[
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  4826
                "we are already in the MiniDebugger"
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  4827
                ErrorRecursion ifFalse:[
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  4828
                    Smalltalk fatalAbort:'recursive error ...'
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  4829
                ]
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  4830
            ].
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  4831
            MiniDebugger isNil ifTrue:[
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  4832
                Smalltalk fatalAbort:'no debugger'
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  4833
            ].
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  4834
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  4835
            "ok, an error occured while in the graphical debugger;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  4836
             lets try MiniDebugger"
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  4837
            ^ MiniDebugger
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  4838
        ].
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  4839
        context := context findNextContextWithSelector:aSelector or:nil or:nil.
16311
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  4840
    ].
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  4841
    "not within Debugger - no problem"
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  4842
    ^ Debugger
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  4843
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  4844
    "Modified: / 23.9.1996 / 12:14:52 / stefan"
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  4845
    "Modified: / 19.5.1999 / 18:05:00 / cg"
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  4846
!
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  4847
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  4848
openDebuggerOnException:ex
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  4849
    "{ Pragma: +optSpace }"
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  4850
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  4851
    "enter the debugger on some unhandled exception"
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  4852
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  4853
    |msgString debugger|
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  4854
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  4855
    msgString := ex descriptionForDebugger.
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  4856
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  4857
    "
16560
Claus Gittinger <cg@exept.de>
parents: 16470
diff changeset
  4858
     if there is no debugger, ask for ignore or exit.
16311
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  4859
     Exit will terminate the application.
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  4860
     ignore will raise an AbortOperationRequest.
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  4861
    "
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  4862
    Debugger isNil ifTrue:[
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  4863
        msgString := 'Error: ' , msgString.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  4864
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  4865
        thisContext isRecursive ifTrue:[
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  4866
            msgString errorPrintCR.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  4867
            Smalltalk fatalAbort:'recursive unhandled exception'
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  4868
        ].
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  4869
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  4870
        Smalltalk isStandAloneApp ifTrue:[
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  4871
            (ex creator == NoHandlerError) ifTrue:[
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  4872
                (HaltInterrupt handles:ex exception) ifTrue:[
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  4873
                    "/ 'Halt ignored' infoPrintCR.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  4874
                    ^ nil
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  4875
                ].
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  4876
                "don't output the message, if the exception is a UserInterrupt (CTRL-C)"
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  4877
                (ex exception creator == UserInterrupt) ifTrue:[
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  4878
                    ex description errorPrintCR.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  4879
                    OperatingSystem exit:130.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  4880
                ].
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  4881
            ].
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  4882
        ].
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  4883
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  4884
        (Dialog notNil and:[Screen default notNil]) ifTrue:[
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  4885
            self
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  4886
                errorNotify:msgString
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  4887
                from:ex suspendedContext
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  4888
                allowDebug:false
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  4889
                mayProceed:ex willProceed.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  4890
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  4891
            "/ arrive here if proceeded...
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  4892
            ^ nil
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  4893
        ].
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  4894
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  4895
        "don't output the message, if the exception is a UserInterrupt (CTRL-C)"
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  4896
        (ex creator == NoHandlerError
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  4897
         and:[ex exception creator == UserInterrupt]) ifTrue:[
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  4898
            OperatingSystem exit:130.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  4899
        ].
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  4900
        msgString errorPrintCR.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  4901
        'Backtrace:' errorPrintCR.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  4902
        thisContext fullPrintAll.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  4903
        OperatingSystem exit:1
16311
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  4904
    ].
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  4905
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  4906
    "
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  4907
     find an appropriate debugger to use
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  4908
    "
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  4909
    debugger := self appropriateDebugger:(thisContext selector).
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  4910
    debugger isNil ifTrue:[
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  4911
        ^ AbortOperationRequest raiseRequest
16311
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  4912
    ].
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  4913
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  4914
    "/ call any registered debug hooks.
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  4915
    "/ These may record or further filter the exception. Each hook gets the exception object and may send any
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  4916
    "/ ex-message (ex proceed, ex return etc.) or raise an Abort signal.
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  4917
    "/ However, the real intent for hooks is to allow saving exceptions in a log file...
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  4918
    DebuggerHooks notNil ifTrue:[
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  4919
        DebuggerHooks do:[:eachHook |
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  4920
            eachHook value:ex.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  4921
        ].
16311
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  4922
    ].
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  4923
    ^ debugger enterException:ex.
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  4924
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  4925
    "Modified: / 05-12-2011 / 11:53:10 / cg"
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  4926
!
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  4927
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  4928
removeDebuggerHook:aBlock
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  4929
    "remove a debugger hook."
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  4930
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  4931
    DebuggerHooks notNil ifTrue:[
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  4932
        DebuggerHooks removeIdentical:aBlock.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  4933
        DebuggerHooks isNil ifTrue:[ DebuggerHooks := nil ].
16311
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  4934
    ].
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  4935
! !
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  4936
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4937
!Object methodsFor:'evaluation'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4938
8690
5894d98a4a61 Implement #argumentCount for Block-compatibility.
Stefan Vogel <sv@exept.de>
parents: 8637
diff changeset
  4939
argumentCount
5894d98a4a61 Implement #argumentCount for Block-compatibility.
Stefan Vogel <sv@exept.de>
parents: 8637
diff changeset
  4940
    "compatibility with Blocks and Messages.
5894d98a4a61 Implement #argumentCount for Block-compatibility.
Stefan Vogel <sv@exept.de>
parents: 8637
diff changeset
  4941
     Answer 0, since we only understand #value.
5894d98a4a61 Implement #argumentCount for Block-compatibility.
Stefan Vogel <sv@exept.de>
parents: 8637
diff changeset
  4942
5894d98a4a61 Implement #argumentCount for Block-compatibility.
Stefan Vogel <sv@exept.de>
parents: 8637
diff changeset
  4943
     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
  4944
5894d98a4a61 Implement #argumentCount for Block-compatibility.
Stefan Vogel <sv@exept.de>
parents: 8637
diff changeset
  4945
    ^ 0
5894d98a4a61 Implement #argumentCount for Block-compatibility.
Stefan Vogel <sv@exept.de>
parents: 8637
diff changeset
  4946
5894d98a4a61 Implement #argumentCount for Block-compatibility.
Stefan Vogel <sv@exept.de>
parents: 8637
diff changeset
  4947
    "
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  4948
        [1 // 0] on:ArithmeticError do:9999
8690
5894d98a4a61 Implement #argumentCount for Block-compatibility.
Stefan Vogel <sv@exept.de>
parents: 8637
diff changeset
  4949
    "
5894d98a4a61 Implement #argumentCount for Block-compatibility.
Stefan Vogel <sv@exept.de>
parents: 8637
diff changeset
  4950
!
5894d98a4a61 Implement #argumentCount for Block-compatibility.
Stefan Vogel <sv@exept.de>
parents: 8637
diff changeset
  4951
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4952
value
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4953
    "return the receiver itself.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4954
     This allows every object to be used where blocks or valueHolders
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4955
     are typically used, and allows for valueHolders and blocks to be
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4956
     used interchangably in some situations.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4957
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4958
     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
  4959
     style ... (the idea was borrowed from the Self language).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4960
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  4961
     WARNING: dont 'optimize' away ifXXX: blocks
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  4962
              (i.e. do NOT replace
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  4963
                        foo ifTrue:[var1] ifFalse:[var2]
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  4964
               by:
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  4965
                        foo ifTrue:var1 ifFalse:var2
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  4966
              )
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  4967
              - the compilers will only generate inline code for the if,
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  4968
                iff the argument(s) are blocks - otherwise, a true send is
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  4969
                generated.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  4970
              This 'oprimization' will work semantically correct,
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  4971
              but execute SLOWER instead."
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4972
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4973
    ^ self
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4974
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4975
    "
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  4976
     #(1 2 3 4) indexOf:5 ifAbsent:0
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  4977
     #(1 2 3 4) indexOf:5 ifAbsent:[0]
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  4978
     1 > 2 ifTrue:['yes'] ifFalse:['no']
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  4979
     1 > 2 ifTrue:'yes' ifFalse:'no'
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4980
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4981
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4982
    "DO NOT DO THIS (its slower)
7458
b0ca7546cbd6 CG: comment in value
Stefan Vogel <sv@exept.de>
parents: 7455
diff changeset
  4983
     (1 > 4) ifTrue:a ifFalse:b
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4984
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4985
     USE (the compiler optimizes blocks in if/while):
7458
b0ca7546cbd6 CG: comment in value
Stefan Vogel <sv@exept.de>
parents: 7455
diff changeset
  4986
     (1 > 4) ifTrue:[a] ifFalse:[b]
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4987
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4988
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4989
    "Modified: 3.5.1996 / 11:57:08 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4990
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4991
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4992
!Object methodsFor:'finalization'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4993
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4994
disposed
6439
0f841258ec4a Use #finalize instead of #disposed
Stefan Vogel <sv@exept.de>
parents: 6421
diff changeset
  4995
    "OBSOLETE INTERFACE: use #finalize
0f841258ec4a Use #finalize instead of #disposed
Stefan Vogel <sv@exept.de>
parents: 6421
diff changeset
  4996
     this is invoked for objects which have been registered
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4997
     in a Registry, when the original object dies.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4998
     Subclasses may redefine this method"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4999
6439
0f841258ec4a Use #finalize instead of #disposed
Stefan Vogel <sv@exept.de>
parents: 6421
diff changeset
  5000
    <resource: #obsolete>
0f841258ec4a Use #finalize instead of #disposed
Stefan Vogel <sv@exept.de>
parents: 6421
diff changeset
  5001
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5002
    ^ self
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5003
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5004
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5005
executor
6439
0f841258ec4a Use #finalize instead of #disposed
Stefan Vogel <sv@exept.de>
parents: 6421
diff changeset
  5006
    "Return the object which does the finalization for me.
0f841258ec4a Use #finalize instead of #disposed
Stefan Vogel <sv@exept.de>
parents: 6421
diff changeset
  5007
     This interface is also VW & Sqeak compatible,"
0f841258ec4a Use #finalize instead of #disposed
Stefan Vogel <sv@exept.de>
parents: 6421
diff changeset
  5008
0f841258ec4a Use #finalize instead of #disposed
Stefan Vogel <sv@exept.de>
parents: 6421
diff changeset
  5009
    "for now, send #shallowCopyForFinalization, to be compatible with
0f841258ec4a Use #finalize instead of #disposed
Stefan Vogel <sv@exept.de>
parents: 6421
diff changeset
  5010
     classes designed for old ST/X versions"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5011
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5012
    ^ self shallowCopyForFinalization
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5013
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5014
6461
f5efaff3457b Allow #registerForFinalization for classes defining their own Lobby.
Stefan Vogel <sv@exept.de>
parents: 6439
diff changeset
  5015
finalizationLobby
f5efaff3457b Allow #registerForFinalization for classes defining their own Lobby.
Stefan Vogel <sv@exept.de>
parents: 6439
diff changeset
  5016
    "answer a Registry used for finalization.
f5efaff3457b Allow #registerForFinalization for classes defining their own Lobby.
Stefan Vogel <sv@exept.de>
parents: 6439
diff changeset
  5017
     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
  5018
     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
  5019
f5efaff3457b Allow #registerForFinalization for classes defining their own Lobby.
Stefan Vogel <sv@exept.de>
parents: 6439
diff changeset
  5020
    ^ FinalizationLobby
f5efaff3457b Allow #registerForFinalization for classes defining their own Lobby.
Stefan Vogel <sv@exept.de>
parents: 6439
diff changeset
  5021
!
f5efaff3457b Allow #registerForFinalization for classes defining their own Lobby.
Stefan Vogel <sv@exept.de>
parents: 6439
diff changeset
  5022
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5023
finalize
6439
0f841258ec4a Use #finalize instead of #disposed
Stefan Vogel <sv@exept.de>
parents: 6421
diff changeset
  5024
    "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
  5025
     in a Registry, when the original object dies.
0f841258ec4a Use #finalize instead of #disposed
Stefan Vogel <sv@exept.de>
parents: 6421
diff changeset
  5026
     Subclasses may redefine this method
0f841258ec4a Use #finalize instead of #disposed
Stefan Vogel <sv@exept.de>
parents: 6421
diff changeset
  5027
     This interface is also VW-compatible"
0f841258ec4a Use #finalize instead of #disposed
Stefan Vogel <sv@exept.de>
parents: 6421
diff changeset
  5028
0f841258ec4a Use #finalize instead of #disposed
Stefan Vogel <sv@exept.de>
parents: 6421
diff changeset
  5029
    "send #disposed for compatibility with existing classes that still
0f841258ec4a Use #finalize instead of #disposed
Stefan Vogel <sv@exept.de>
parents: 6421
diff changeset
  5030
     implement the obsolete #disposed message"
0f841258ec4a Use #finalize instead of #disposed
Stefan Vogel <sv@exept.de>
parents: 6421
diff changeset
  5031
0f841258ec4a Use #finalize instead of #disposed
Stefan Vogel <sv@exept.de>
parents: 6421
diff changeset
  5032
    ^ self disposed
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5033
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5034
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5035
reRegisterForFinalization
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5036
    "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
  5037
     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
  5038
     the receiver is garbage collected."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5039
6461
f5efaff3457b Allow #registerForFinalization for classes defining their own Lobby.
Stefan Vogel <sv@exept.de>
parents: 6439
diff changeset
  5040
    self finalizationLobby registerChange:self
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5041
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5042
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5043
registerForFinalization
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5044
    "register mySelf for later finalization.
6461
f5efaff3457b Allow #registerForFinalization for classes defining their own Lobby.
Stefan Vogel <sv@exept.de>
parents: 6439
diff changeset
  5045
     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
  5046
     the receiver is garbage collected."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5047
6461
f5efaff3457b Allow #registerForFinalization for classes defining their own Lobby.
Stefan Vogel <sv@exept.de>
parents: 6439
diff changeset
  5048
    self finalizationLobby register:self
f5efaff3457b Allow #registerForFinalization for classes defining their own Lobby.
Stefan Vogel <sv@exept.de>
parents: 6439
diff changeset
  5049
!
f5efaff3457b Allow #registerForFinalization for classes defining their own Lobby.
Stefan Vogel <sv@exept.de>
parents: 6439
diff changeset
  5050
f5efaff3457b Allow #registerForFinalization for classes defining their own Lobby.
Stefan Vogel <sv@exept.de>
parents: 6439
diff changeset
  5051
shallowCopyForFinalization
f5efaff3457b Allow #registerForFinalization for classes defining their own Lobby.
Stefan Vogel <sv@exept.de>
parents: 6439
diff changeset
  5052
    "OBSOLETE INTERFACE: use #executor.
f5efaff3457b Allow #registerForFinalization for classes defining their own Lobby.
Stefan Vogel <sv@exept.de>
parents: 6439
diff changeset
  5053
     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
  5054
     (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
  5055
     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
  5056
f5efaff3457b Allow #registerForFinalization for classes defining their own Lobby.
Stefan Vogel <sv@exept.de>
parents: 6439
diff changeset
  5057
    <resource: #obsolete>
f5efaff3457b Allow #registerForFinalization for classes defining their own Lobby.
Stefan Vogel <sv@exept.de>
parents: 6439
diff changeset
  5058
f5efaff3457b Allow #registerForFinalization for classes defining their own Lobby.
Stefan Vogel <sv@exept.de>
parents: 6439
diff changeset
  5059
    ^ self shallowCopy
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5060
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5061
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5062
unregisterForFinalization
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5063
    "unregister mySelf from later finalization"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5064
6461
f5efaff3457b Allow #registerForFinalization for classes defining their own Lobby.
Stefan Vogel <sv@exept.de>
parents: 6439
diff changeset
  5065
    self finalizationLobby unregister:self
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5066
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5067
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5068
!Object methodsFor:'initialization'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5069
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5070
initialize
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5071
    "just to ignore initialize to objects which do not need it"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5072
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5073
    ^ self
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5074
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5075
17677
4b68c0b48d73 class: Object
Claus Gittinger <cg@exept.de>
parents: 17590
diff changeset
  5076
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5077
!Object methodsFor:'interrupt handling'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5078
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5079
childSignalInterrupt
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5080
    "death of a child process (unix process) - do nothing"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5081
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5082
    ^ self
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5083
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5084
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5085
customInterrupt
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5086
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5087
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5088
    "a custom interrupt - but no handler has defined"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5089
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5090
    self error:'custom interrupt' mayProceed:true
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5091
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5092
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5093
errorInterrupt:errorID with:aParameter
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5094
    "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
  5095
     to the 'errorInterruptWithIDAndParameter(id, param)' function,
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5096
     which can be called from C subsystems to raise an (asynchronous)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5097
     error exception.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5098
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5099
     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
  5100
     used from other C subsystems too, to upcast errors.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5101
     Especially, for subsystems which call errorHandler functions asynchronously.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5102
     IDs (currently) used:
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5103
        #DisplayError ..... x-error interrupt
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5104
        #XtError      ..... xt-error interrupt (Xt interface is not yet published)
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5105
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5106
6263
4e7a970e4cfc errorInterrupt:with: fixed (care for nil handlers in Objmem)
Claus Gittinger <cg@exept.de>
parents: 6235
diff changeset
  5107
    |handlers handler|
4e7a970e4cfc errorInterrupt:with: fixed (care for nil handlers in Objmem)
Claus Gittinger <cg@exept.de>
parents: 6235
diff changeset
  5108
4e7a970e4cfc errorInterrupt:with: fixed (care for nil handlers in Objmem)
Claus Gittinger <cg@exept.de>
parents: 6235
diff changeset
  5109
    handlers := ObjectMemory registeredErrorInterruptHandlers.
4e7a970e4cfc errorInterrupt:with: fixed (care for nil handlers in Objmem)
Claus Gittinger <cg@exept.de>
parents: 6235
diff changeset
  5110
    handlers notNil ifTrue:[
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5111
        handler := handlers at:errorID ifAbsent:nil.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5112
        handler notNil ifTrue:[
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5113
            "/
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5114
            "/ handler found; let it do whatever it wants ...
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5115
            "/
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5116
            handler errorInterrupt:errorID with:aParameter.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5117
            ^ self
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5118
        ].
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5119
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5120
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
    "/ no handler - raise errorSignal passing the errorId as parameter
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5123
    "/
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  5124
    ^ Error
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5125
        raiseRequestWith:errorID
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5126
        errorString:('Subsystem error. ErrorID = ' , errorID printString)
5755
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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5129
exceptionInterrupt
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5130
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5131
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5132
    "exception interrupt - enter debugger"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5133
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5134
    self error:'exception Interrupt' mayProceed:true
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5135
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5136
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5137
fpExceptionInterrupt
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5138
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5139
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5140
    "a floating point exception occured - this one
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5141
     has to be handled differently since it comes asynchronous
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5142
     on some machines (for example, on machines with a separate FPU
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5143
     or superscalar architectures. Also, errors from within primitive code
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5144
     (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
  5145
     mechanism this way."
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
    |where rec|
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
    where := thisContext sender.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5150
    rec := where receiver.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5151
    rec isNumber ifTrue:[
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5152
        ^ rec class
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5153
            raise:#domainErrorSignal
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5154
            receiver:rec
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5155
            selector:where selector
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5156
            arguments:(where args asArray)
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5157
            errorString:'floating point exception'
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5158
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5159
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5160
    "/ could be in some C-library ...
7402
b9d45ce2463a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7359
diff changeset
  5161
    ^ DomainError raise
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5162
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5163
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5164
internalError:msg
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5165
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5166
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5167
    "this is triggered, when VM hits some bad error,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5168
     such as corrupted class, corrupted method/selector array
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5169
     etc. The argument string gives some more information on what happened.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5170
     (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
  5171
     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
  5172
     this error occurred ...."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5173
8330
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
  5174
    VMInternalError raiseWith:self errorString:msg
5755
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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5177
ioInterrupt
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5178
    "{ Pragma: +optSpace }"
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
    "I/O (SIGIO/SIGPOLL) interrupt (supposed to be sent to Processor).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5181
     If we arrive here, there is either no handler (ObjMem>>ioInterruptHandler)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5182
     or it does not understand the ioInterrupt message.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5183
     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
  5184
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5185
    self error:'I/O Interrupt - but no handler' mayProceed:true
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5186
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5187
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5188
memoryInterrupt
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5189
    "{ Pragma: +optSpace }"
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
    "out-of-memory interrupt and no handler - enter debugger"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5192
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5193
    self error:'almost out of memory' mayProceed:true
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5194
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5195
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5196
recursionInterrupt
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5197
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5198
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5199
    "recursion limit (actually: stack overflow) interrupt.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5200
     This interrupt is triggered, when a process stack grows above
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5201
     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
  5202
     could be caught.
e9970db3e02f recursionInterrupt fixes for win32 (& comment changed)
Claus Gittinger <cg@exept.de>
parents: 6157
diff changeset
  5203
     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
  5204
     and the exception can be resumed.
e9970db3e02f recursionInterrupt fixes for win32 (& comment changed)
Claus Gittinger <cg@exept.de>
parents: 6157
diff changeset
  5205
     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
  5206
     is not proceedable.
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  5207
     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
  5208
     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
  5209
     or debug for a while.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5210
     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
  5211
     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
  5212
     terminates the process."
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5213
16408
e8076fc8d337 class: Object
Claus Gittinger <cg@exept.de>
parents: 16401
diff changeset
  5214
    |con remaining sender nSkipped caller level n|
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5215
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5216
    (con := thisContext) isRecursive ifFalse:[
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5217
"/        Processor activeProcess usedStackSize < Processor activeProcess maximumStackSize ifTrue:[
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5218
"/            "/ mhmh - it hit me, but I am not responsible ...
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5219
"/            'Stray recursionInterrupt ...' infoPrintCR.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5220
"/            ^ self
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5221
"/        ].
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5222
        ObjectMemory infoPrinting ifTrue:[
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5223
            level := 0.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5224
            caller := thisContext sender.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5225
            [caller notNil] whileTrue:[
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5226
                level := level + 1.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5227
                caller := caller sender.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5228
            ].
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5229
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5230
            'Object [info]: recursionInterrupt from:' printCR.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5231
            con := con sender.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5232
            remaining := 500.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5233
            n := 0.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5234
            [con notNil and:[remaining > 0]] whileTrue:[
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5235
                sender := con sender.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5236
                '| ' print. con fullPrint.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5237
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5238
                nSkipped := 0.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5239
                [sender notNil and:[sender sender notNil
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5240
                and:[sender selector == con selector
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5241
                and:[sender sender selector == con selector
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5242
                and:[sender method == con method]]]]] whileTrue:[
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5243
                    nSkipped := nSkipped + 1.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5244
                    con := sender.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5245
                    sender := con sender.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5246
                ].
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5247
                nSkipped > 0 ifTrue:[
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5248
                    '| ... ***** ' print. nSkipped print. ' recursive contexts skipped *****' printCR.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5249
                ].
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5250
                con := sender.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5251
                remaining := remaining - 1
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5252
            ].
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5253
        ].
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5254
        ^ RecursionInterruptSignal raiseSignal
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5255
    ]
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5256
6175
e9970db3e02f recursionInterrupt fixes for win32 (& comment changed)
Claus Gittinger <cg@exept.de>
parents: 6157
diff changeset
  5257
    "Modified: / 10.11.2001 / 15:15:56 / cg"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5258
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5259
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5260
schedulerInterrupt
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5261
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5262
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5263
    "scheduler interrupt (supposed to be sent to Processor).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5264
     If we arrive here, either the Processor does not understand it,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5265
     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
  5266
     big trouble. Enter debugger."
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
    self error:'schedulerInterrupt - but no Processor' mayProceed:true
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5269
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5270
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5271
signalInterrupt:signalNumber
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5272
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5273
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  5274
    "unix signal occured - some signals are handled as Smalltalk Exceptions
10016
e174cf2d1f43 crash save refactored
Claus Gittinger <cg@exept.de>
parents: 9993
diff changeset
  5275
     (SIGPIPE), others (SIGBUS) are rather fatal...
11236
c196f9dedf66 exception description in debugger
Claus Gittinger <cg@exept.de>
parents: 11221
diff changeset
  5276
     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
  5277
     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
  5278
     TODO: add another argument, giving more detailed signal info (PC, VADDR,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5279
     exact cause etc.). This helps if segvs occur in primitive code.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5280
     Currently (temporary kludge), these are passed as global variables."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5281
6537
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  5282
    |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
  5283
     action title screen|
41396e0cc89f Fix #signalInterrupt: for multi-display and headless.
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
  5284
13254
5cf789a74946 changed: #signalInterrupt:
Claus Gittinger <cg@exept.de>
parents: 13229
diff changeset
  5285
    thisContext isRecursive ifTrue:[
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5286
        'Severe error: signalInterrupt while processing a signalInterrupt.' errorPrintCR.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5287
        'Terminating process ' errorPrint. Processor activeProcess errorPrintCR.
13710
277f3a5697e8 changed: #signalInterrupt:
Claus Gittinger <cg@exept.de>
parents: 13656
diff changeset
  5288
"/        GenericException handle:[:ex |
277f3a5697e8 changed: #signalInterrupt:
Claus Gittinger <cg@exept.de>
parents: 13656
diff changeset
  5289
"/            "/ ignore any error during termination
277f3a5697e8 changed: #signalInterrupt:
Claus Gittinger <cg@exept.de>
parents: 13656
diff changeset
  5290
"/        ] do:[
277f3a5697e8 changed: #signalInterrupt:
Claus Gittinger <cg@exept.de>
parents: 13656
diff changeset
  5291
"/           Processor activeProcess terminate.
277f3a5697e8 changed: #signalInterrupt:
Claus Gittinger <cg@exept.de>
parents: 13656
diff changeset
  5292
"/        ].
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5293
        MiniDebugger enter.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5294
        Processor activeProcess terminateNoSignal.
13254
5cf789a74946 changed: #signalInterrupt:
Claus Gittinger <cg@exept.de>
parents: 13229
diff changeset
  5295
    ].
5cf789a74946 changed: #signalInterrupt:
Claus Gittinger <cg@exept.de>
parents: 13229
diff changeset
  5296
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5297
    "if there has been an ST-signal installed, use it ..."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5298
    sig := OperatingSystem operatingSystemSignal:signalNumber.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5299
    sig notNil ifTrue:[
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5300
        sig raiseSignalWith:signalNumber.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5301
        ^ self.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5302
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5303
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5304
    "/ if handled, raise OSSignalInterruptSignal
8330
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
  5305
    OSSignalInterrupt isHandled ifTrue:[
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5306
        OSSignalInterrupt raiseRequestWith:signalNumber.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5307
        ^ self.
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  5308
    ].
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  5309
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  5310
    "
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  5311
     special cases
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5312
        - SIGPWR: power failure - write a crash image and continue
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5313
        - SIGHUP: hang up - write a crash image and exit
10922
a1ff606fca18 #signalInterrupt: - comment
Stefan Vogel <sv@exept.de>
parents: 10918
diff changeset
  5314
    "
a1ff606fca18 #signalInterrupt: - comment
Stefan Vogel <sv@exept.de>
parents: 10918
diff changeset
  5315
    (signalNumber == OperatingSystem sigPWR) ifTrue:[
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5316
        SnapshotError ignoreIn:[ObjectMemory writeCrashImage].
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5317
        ^ self.
10922
a1ff606fca18 #signalInterrupt: - comment
Stefan Vogel <sv@exept.de>
parents: 10918
diff changeset
  5318
    ].
a1ff606fca18 #signalInterrupt: - comment
Stefan Vogel <sv@exept.de>
parents: 10918
diff changeset
  5319
    (signalNumber == OperatingSystem sigHUP) ifTrue:[
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5320
        SnapshotError ignoreIn:[ObjectMemory writeCrashImage].
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5321
        'Object [info]: exit due to hangup signal.' errorPrintCR.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5322
        Smalltalk exit:1.
7031
eae2df0a3ad2 Exit Smalltalk in SIGHUP
Stefan Vogel <sv@exept.de>
parents: 6964
diff changeset
  5323
    ].
5856
6d3df9ad361e save crash image when sigPWR or sigHUP arrives
Claus Gittinger <cg@exept.de>
parents: 5824
diff changeset
  5324
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5325
    name := OperatingSystem nameForSignal:signalNumber.
6388
41396e0cc89f Fix #signalInterrupt: for multi-display and headless.
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
  5326
41396e0cc89f Fix #signalInterrupt: for multi-display and headless.
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
  5327
    "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
  5328
    (Screen isNil
6388
41396e0cc89f Fix #signalInterrupt: for multi-display and headless.
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
  5329
     or:[(screen := Screen current) isNil
6778
87e2d95ce8a4 Raise #drawingOnClosedDeviceSignal instead of #error
Stefan Vogel <sv@exept.de>
parents: 6764
diff changeset
  5330
     or:[(screen := Screen default) isNil
87e2d95ce8a4 Raise #drawingOnClosedDeviceSignal instead of #error
Stefan Vogel <sv@exept.de>
parents: 6764
diff changeset
  5331
     or:[screen isOpen not]]]) ifTrue:[
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5332
        ^ self startMiniDebuggerOrExit:'OS-Signal (' , name, ')'.
6388
41396e0cc89f Fix #signalInterrupt: for multi-display and headless.
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
  5333
    ].
41396e0cc89f Fix #signalInterrupt: for multi-display and headless.
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
  5334
41396e0cc89f Fix #signalInterrupt: for multi-display and headless.
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
  5335
    "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
  5336
     otherwise display stays locked"
41396e0cc89f Fix #signalInterrupt: for multi-display and headless.
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
  5337
    screen ungrabPointer; ungrabKeyboard.
41396e0cc89f Fix #signalInterrupt: for multi-display and headless.
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
  5338
7031
eae2df0a3ad2 Exit Smalltalk in SIGHUP
Stefan Vogel <sv@exept.de>
parents: 6964
diff changeset
  5339
    here := thisContext.
eae2df0a3ad2 Exit Smalltalk in SIGHUP
Stefan Vogel <sv@exept.de>
parents: 6964
diff changeset
  5340
    badContext := here sender.          "the context, in which the signal occurred"
eae2df0a3ad2 Exit Smalltalk in SIGHUP
Stefan Vogel <sv@exept.de>
parents: 6964
diff changeset
  5341
6388
41396e0cc89f Fix #signalInterrupt: for multi-display and headless.
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
  5342
    "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
  5343
    Screen currentScreenQuerySignal answer:screen do:[
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5344
        "
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5345
         SIGBUS, SIGSEGV and SIGILL do not make sense to ignore (i.e. continue)
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5346
         since the system will retry the faulty instruction, which leads to
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5347
         another signal - to avoid frustration, better not offer this option.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5348
        "
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5349
        fatal := OperatingSystem isFatalSignal:signalNumber.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5350
        fatal ifTrue:[
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5351
            (Debugger isNil or:[here isRecursive]) ifTrue:[
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5352
                'Object [hard error]: signal ' errorPrint. signalNumber errorPrintCR.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5353
                ^ self startMiniDebuggerOrExit:'OS-Signal (' , name, ')'.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5354
            ].
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5355
            "
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5356
             a hard signal - go into debugger immediately
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5357
            "
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5358
            msg := 'OS-signal: ', name.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5359
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5360
            "/ the IRQ-PC is passed as low-hi, to avoid the need
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5361
            "/ to allocate a LargeInteger in the VM during signal
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5362
            "/ time. I know, this is ugly.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5363
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5364
            InterruptPcLow notNil ifTrue:[
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5365
                pc := InterruptPcLow + (InterruptPcHi bitShift:((SmallInteger maxBits + 1) // 2)).
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5366
                pc ~~ 0 ifTrue:[
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5367
                    msg := msg , ' PC=' , (pc printStringRadix:16)
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5368
                ].
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5369
            ].
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5370
            InterruptAddrLow notNil ifTrue:[
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5371
                addr := InterruptAddrLow + (InterruptAddrHi bitShift:((SmallInteger maxBits + 1) // 2)).
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5372
                addr ~~ 0 ifTrue:[
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5373
                    msg := msg , ' ADDR=' , (addr printStringRadix:16)
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5374
                ].
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5375
            ].
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5376
            Debugger enter:here withMessage:msg mayProceed:false.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5377
            "unreachable"
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5378
            ^ nil.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5379
        ].
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5380
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5381
        "if possible, open an option box asking the user what do.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5382
         Otherwise, start a debugger"
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5383
        Dialog notNil ifTrue:[
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5384
            OperatingSystem isOSXlike ifTrue:[
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5385
                titles := #('Save crash image' 'Dump core' 'GDB' 'Exit ST/X' 'Debug').
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5386
                actions := #(save core gdb exit debug).
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5387
            ] ifFalse:[
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5388
                titles := #('Save crash image' 'Dump core' 'Exit ST/X' 'Debug').
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5389
                actions := #(save core exit debug).
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5390
            ].
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5391
            action := nil.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5392
            title := 'OS Signal caught (' , name, ')'.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5393
            title := (title , '\[in ST-process: ' , Processor activeProcess nameOrId ,']') withCRs.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5394
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5395
            "/ if caught while in the scheduler or event dispatcher,
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5396
            "/ a modal dialog is not possible ...
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5397
            "/ (therefore, abort & return does not makes sense)
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5398
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5399
            Processor activeProcess isSystemProcess ifFalse:[
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5400
                titles := #('Abort') , titles.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5401
                actions := #(abort), actions.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5402
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5403
                badContext canReturn ifTrue:[
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5404
                    titles := #('Return') , titles.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5405
                    actions :=  #(return), actions.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5406
                ].
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5407
            ].
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5408
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5409
            fatal ifFalse:[
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5410
                titles := titles, #('Ignore').
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5411
                actions := actions , #(ignore).
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5412
            ].
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5413
            action := Dialog choose:title
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5414
                             labels:titles
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5415
                             values:actions
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5416
                             default:(fatal ifTrue:[nil] ifFalse:[#ignore]).
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5417
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5418
            "Dialog may fail (if system process), default action is debug"
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5419
            action isEmptyOrNil ifTrue:[action := #debug].
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5420
        ] ifFalse:[
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5421
            action := #debug.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5422
        ].
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5423
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5424
        action == #save ifTrue:[
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5425
            ObjectMemory writeCrashImage
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5426
        ].
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5427
        action == #gdb ifTrue:[
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5428
            |pid|
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5429
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5430
            pid := OperatingSystem getProcessId.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5431
            OperatingSystem openTerminalWithCommand:('gdb -p %1' bindWith:pid) inBackground:true.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5432
            MiniDebugger enter. "/ to stop, so gdb can show where we are
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5433
            AbortOperationRequest raise.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5434
        ].
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5435
        action == #core ifTrue:[
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5436
            Smalltalk fatalAbort
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5437
        ].
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5438
        action == #exit ifTrue:[
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5439
            Smalltalk exit:10.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5440
        ].
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5441
        action == #return ifTrue:[
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5442
            badContext return
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5443
        ].
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5444
        action == #abort ifTrue:[
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5445
            AbortOperationRequest raise.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5446
        ].
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5447
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5448
        action == #debug ifTrue:[
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5449
            Debugger isNil ifTrue:[
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5450
                ^ self startMiniDebuggerOrExit:'OS-Signal (' , name, ')'.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5451
            ].
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5452
            Debugger enter:here withMessage:('OS-Signal ', name) mayProceed:true.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5453
        ].
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5454
        "action == #ignore"
13261
Claus Gittinger <cg@exept.de>
parents: 13258
diff changeset
  5455
    ].
Claus Gittinger <cg@exept.de>
parents: 13258
diff changeset
  5456
13710
277f3a5697e8 changed: #signalInterrupt:
Claus Gittinger <cg@exept.de>
parents: 13656
diff changeset
  5457
    "Modified: / 15-09-2011 / 16:38:14 / cg"
5755
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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5460
spyInterrupt
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5461
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5462
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5463
    "spy interrupt and no handler - enter debugger"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5464
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5465
    self error:'spy Interrupt - but no handler' mayProceed:true
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5466
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5467
6388
41396e0cc89f Fix #signalInterrupt: for multi-display and headless.
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
  5468
startMiniDebuggerOrExit:text
41396e0cc89f Fix #signalInterrupt: for multi-display and headless.
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
  5469
    "some critical condition happened.
41396e0cc89f Fix #signalInterrupt: for multi-display and headless.
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
  5470
     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
  5471
41396e0cc89f Fix #signalInterrupt: for multi-display and headless.
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
  5472
    MiniDebugger isNil ifTrue:[
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5473
        "a system without debugging facilities (i.e. a standalone system)
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5474
         output a message and exit."
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5475
        ('Object [error]: exit due to ', text, ' - and no debugger.') errorPrintCR.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5476
        OperatingSystem exit:99.
6388
41396e0cc89f Fix #signalInterrupt: for multi-display and headless.
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
  5477
    ].
41396e0cc89f Fix #signalInterrupt: for multi-display and headless.
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
  5478
    MiniDebugger enterWithMessage:text mayProceed:true.
41396e0cc89f Fix #signalInterrupt: for multi-display and headless.
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
  5479
!
41396e0cc89f Fix #signalInterrupt: for multi-display and headless.
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
  5480
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5481
timerInterrupt
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5482
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5483
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5484
    "timer interrupt and no handler - enter debugger"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5485
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5486
    self error:'timer Interrupt - but no handler' mayProceed:true
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5487
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5488
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5489
userInterrupt
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5490
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5491
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5492
    "user (^c) interrupt.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5493
     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
  5494
     controlling tty (i.e. in the xterm)."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5495
20027
5be764ee44fb #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 19846
diff changeset
  5496
    UserInterrupt raiseRequest
5be764ee44fb #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 19846
diff changeset
  5497
!
5be764ee44fb #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 19846
diff changeset
  5498
5be764ee44fb #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 19846
diff changeset
  5499
userInterruptIn:aContext from:originator
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5500
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5501
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5502
    "user (^c) interrupt - enter debugger, but show aContext
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  5503
     as top-context.
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  5504
     This is used to hide any intermediate scheduler contexts,
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5505
     in case of an interrupted process. Typically, this is sent by
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5506
     the WindowGroup, when a keyboardEvent for the ctrl-C key is
20027
5be764ee44fb #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 19846
diff changeset
  5507
     processed.
5be764ee44fb #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 19846
diff changeset
  5508
     Set the originator to distinguish UserInterrupts from controlling tty vs. 
5be764ee44fb #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 19846
diff changeset
  5509
     UserInterrupt from a view."
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
    <context: #return>
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5512
20027
5be764ee44fb #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 19846
diff changeset
  5513
    UserInterrupt raiseRequestWith:originator errorString:nil in:aContext
5755
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
    "Created: / 18.10.1996 / 20:46:04 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5516
    "Modified: / 20.10.1996 / 13:06:38 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5517
    "Modified: / 26.7.1999 / 10:58:49 / stefan"
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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5520
!Object methodsFor:'message sending'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5521
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5522
perform:aSelector
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5523
    "send the message aSelector to the receiver"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5524
11335
c061d08b766f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11314
diff changeset
  5525
    <resource: #skipInDebuggersWalkBack>
c061d08b766f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11314
diff changeset
  5526
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5527
%{
18240
28af09029a8b ifdef for SCHTEAM engine changed (not relevant for ST/X)
Claus Gittinger <cg@exept.de>
parents: 18238
diff changeset
  5528
#ifdef __SCHTEAM__
18238
0b3b5ced099d oops - sorry
Claus Gittinger <cg@exept.de>
parents: 18231
diff changeset
  5529
    return context.PERFORM(self, aSelector);
18231
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  5530
#else
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5531
    REGISTER OBJ sel = aSelector;
16588
eb24b473a3ba Fix for bug in Object>>perform(with:(with:)) - care for nil or SmallInteger selectors.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16583
diff changeset
  5532
    int hash0;
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5533
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5534
    if (InterruptPending == nil) {
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5535
        struct inlineCache *pIlc;
16169
5a4e80279be4 Object>>#perform:(with:(with:)): more performant implementation
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16126
diff changeset
  5536
18231
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  5537
# define nways 2
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  5538
# define nilcs 131
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  5539
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  5540
# define SEL_AND_ILC_INIT_1(l)   { { nil, nil } , { __ILCPERF0(l) , __ILCPERF0(l) } , 0 }
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  5541
# define SEL_AND_ILC_INIT_2(l)   SEL_AND_ILC_INIT_1(l)   , SEL_AND_ILC_INIT_1(l)
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  5542
# define SEL_AND_ILC_INIT_4(l)   SEL_AND_ILC_INIT_2(l)   , SEL_AND_ILC_INIT_2(l)
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  5543
# define SEL_AND_ILC_INIT_8(l)   SEL_AND_ILC_INIT_4(l)   , SEL_AND_ILC_INIT_4(l)
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  5544
# define SEL_AND_ILC_INIT_16(l)  SEL_AND_ILC_INIT_8(l)   , SEL_AND_ILC_INIT_8(l)
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  5545
# define SEL_AND_ILC_INIT_32(l)  SEL_AND_ILC_INIT_16(l)  , SEL_AND_ILC_INIT_16(l)
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  5546
# define SEL_AND_ILC_INIT_32(l)  SEL_AND_ILC_INIT_16(l)  , SEL_AND_ILC_INIT_16(l)
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  5547
# define SEL_AND_ILC_INIT_64(l)  SEL_AND_ILC_INIT_32(l)  , SEL_AND_ILC_INIT_32(l)
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  5548
# define SEL_AND_ILC_INIT_128(l) SEL_AND_ILC_INIT_64(l)  , SEL_AND_ILC_INIT_64(l)
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  5549
# define SEL_AND_ILC_INIT_256(l) SEL_AND_ILC_INIT_128(l) , SEL_AND_ILC_INIT_128(l)
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  5550
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  5551
# define SEL_AND_ILC_INIT_131(l) SEL_AND_ILC_INIT_128(l) , SEL_AND_ILC_INIT_2(l) , SEL_AND_ILC_INIT_1(l)
16169
5a4e80279be4 Object>>#perform:(with:(with:)): more performant implementation
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16126
diff changeset
  5552
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5553
        static struct { OBJ sel[nways]; struct inlineCache ilc[nways]; int flip; } sel_and_ilc[nilcs] = { SEL_AND_ILC_INIT_131(@line) };
13416
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5554
18231
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  5555
# undef SEL_AND_ILC_INIT_1
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  5556
# undef SEL_AND_ILC_INIT_2
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  5557
# undef SEL_AND_ILC_INIT_4
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  5558
# undef SEL_AND_ILC_INIT_8
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  5559
# undef SEL_AND_ILC_INIT_16
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  5560
# undef SEL_AND_ILC_INIT_32
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  5561
# undef SEL_AND_ILC_INIT_64
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  5562
# undef SEL_AND_ILC_INIT_128
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  5563
# undef SEL_AND_ILC_INIT_256
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  5564
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  5565
# undef SEL_AND_ILC_INIT_131
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  5566
# undef SEL_AND_ILC_INIT_257
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  5567
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  5568
# define TRY(n)                                  \
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5569
        if (sel == sel_and_ilc[hash0].sel[n]) { \
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5570
            pIlc = &sel_and_ilc[hash0].ilc[n];  \
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5571
            goto perform0_send_and_return;      \
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5572
        }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5573
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5574
        if (__isNonNilObject(sel)) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5575
            hash0 = __MAKE_HASH__(__GET_HASH(sel)) % nilcs;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5576
        } else {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5577
            /* sel is either nil or smallint, use its value as hash */
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5578
            hash0 = (INT)sel % nilcs;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5579
        }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5580
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5581
        TRY(0);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5582
        TRY(1);
16169
5a4e80279be4 Object>>#perform:(with:(with:)): more performant implementation
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16126
diff changeset
  5583
18231
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  5584
# undef TRY
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5585
        /*printf("Object >> #perform: #%s --> no PIC found\n", __symbolVal(aSelector));*/
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5586
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5587
        pIlc = &sel_and_ilc[hash0].ilc[sel_and_ilc[hash0].flip];
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5588
        sel_and_ilc[hash0].sel[sel_and_ilc[hash0].flip] = sel;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5589
        sel_and_ilc[hash0].flip = (sel_and_ilc[hash0].flip + 1) % nways;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5590
        pIlc->ilc_func = __SEND0ADDR__;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5591
        if (pIlc->ilc_poly) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5592
            __flushPolyCache(pIlc->ilc_poly);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5593
            pIlc->ilc_poly = 0;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5594
        }
13416
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5595
perform0_send_and_return:
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5596
        RETURN ( (*(pIlc->ilc_func))(self, sel, nil, pIlc) );
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5597
    } else {
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5598
        static struct inlineCache ilc0 = __DUMMYILCSELF0(@line+1);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5599
        RETURN (_SEND0(self, aSelector, nil, &ilc0));
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5600
    }
18240
28af09029a8b ifdef for SCHTEAM engine changed (not relevant for ST/X)
Claus Gittinger <cg@exept.de>
parents: 18238
diff changeset
  5601
#endif /* not __SCHTEAM__ */
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5602
%}.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5603
    ^ self perform:aSelector withArguments:#()
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5604
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5605
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5606
perform:aSelector inClass:aClass withArguments:argArray
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  5607
    "send the message aSelector with all args taken from argArray
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5608
     to the receiver as a super-send message.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5609
     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
  5610
     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
  5611
     immediate superclass).
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  5612
     Thus, it is (theoretically) possible to do
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5613
         '5 perform:#< inClass:Magnitude withArguments:#(6)'
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5614
     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
  5615
     This method is used by the interpreter to evaluate super sends
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5616
     and could be used for very special behavior (language extension ?).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5617
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5618
     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
  5619
5769
8f874be55bc9 lookup-class check in #perform:inClass was too strong.
Claus Gittinger <cg@exept.de>
parents: 5755
diff changeset
  5620
    |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
  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
     check, if aClass is really a superclass of the receiver
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5624
    "
5769
8f874be55bc9 lookup-class check in #perform:inClass was too strong.
Claus Gittinger <cg@exept.de>
parents: 5755
diff changeset
  5625
    myClass := self class.
8f874be55bc9 lookup-class check in #perform:inClass was too strong.
Claus Gittinger <cg@exept.de>
parents: 5755
diff changeset
  5626
    (myClass == aClass or:[myClass isSubclassOf:aClass]) ifFalse:[
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5627
        self error:'lookup-class argument is not a superclass of the receiver'.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5628
        ^ nil
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5629
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5630
%{
18240
28af09029a8b ifdef for SCHTEAM engine changed (not relevant for ST/X)
Claus Gittinger <cg@exept.de>
parents: 18238
diff changeset
  5631
#ifdef __SCHTEAM__
18231
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  5632
#else
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5633
    REGISTER OBJ *argP;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5634
    int nargs, i;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5635
8934
32a063645991 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8930
diff changeset
  5636
    if (__isArrayLike(argArray)) {
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5637
        nargs = __arraySize(argArray);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5638
        argP = __arrayVal(argArray);
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5639
    } else {
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5640
        if (__isNonNilObject(argArray)) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5641
            static struct inlineCache ilcSize = __ILC0(@line+1);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5642
            numberOfArgs = (*ilcSize.ilc_func)(argArray, @symbol(size), nil, &ilcSize);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5643
            if (!__isSmallInteger(numberOfArgs))
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5644
                goto bad;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5645
            nargs = __intVal(numberOfArgs);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5646
            argP = (OBJ *)(&a1);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5647
            for (i=1; i <= nargs; i++) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5648
                *argP++ = __AT_(argArray, __mkSmallInteger(i));
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5649
            }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5650
            argP = (OBJ *)(&a1);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5651
        } else {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5652
            nargs = 0;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5653
        }
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5654
    }
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5655
    switch (nargs) {
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5656
        case 0:
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5657
            {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5658
                static struct inlineCache ilc0 = __DUMMYILCSELF0(@line+1);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5659
                RETURN ( _SEND0(self, aSelector, aClass, &ilc0));
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5660
            }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5661
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5662
        case 1:
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5663
            {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5664
                static struct inlineCache ilc1 = __DUMMYILCSELF1(@line+1);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5665
                RETURN ( _SEND1(self, aSelector, aClass, &ilc1, argP[0]));
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5666
            }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5667
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5668
        case 2:
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5669
            {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5670
                static struct inlineCache ilc2 = __DUMMYILCSELF2(@line+1);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5671
                RETURN ( _SEND2(self, aSelector, aClass, &ilc2, argP[0], argP[1]));
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5672
            }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5673
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5674
        case 3:
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5675
            {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5676
                static struct inlineCache ilc3 = __DUMMYILCSELF3(@line+1);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5677
                RETURN ( _SEND3(self, aSelector, aClass, &ilc3,
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5678
                                argP[0], argP[1], argP[2]));
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5679
            }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5680
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5681
        case 4:
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5682
            {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5683
                static struct inlineCache ilc4 = __DUMMYILCSELF4(@line+1);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5684
                RETURN ( _SEND4(self, aSelector, aClass, &ilc4,
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5685
                                argP[0], argP[1], argP[2], argP[3]));
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5686
            }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5687
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5688
        case 5:
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5689
            {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5690
                static struct inlineCache ilc5 = __DUMMYILCSELF5(@line+1);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5691
                RETURN ( _SEND5(self, aSelector, aClass, &ilc5,
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5692
                                argP[0], argP[1], argP[2], argP[3], argP[4]));
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5693
            }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5694
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5695
        case 6:
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5696
            {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5697
                static struct inlineCache ilc6 = __DUMMYILCSELF6(@line+1);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5698
                RETURN ( _SEND6(self, aSelector, aClass, &ilc6,
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5699
                                argP[0], argP[1], argP[2], argP[3], argP[4], argP[5]));
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5700
            }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5701
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5702
        case 7:
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5703
            {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5704
                static struct inlineCache ilc7 = __DUMMYILCSELF7(@line+1);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5705
                RETURN ( _SEND7(self, aSelector, aClass, &ilc7,
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5706
                                argP[0], argP[1], argP[2], argP[3], argP[4], argP[5],
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5707
                                argP[6]));
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5708
            }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5709
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5710
        case 8:
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5711
            {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5712
                static struct inlineCache ilc8 = __DUMMYILCSELF8(@line+1);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5713
                RETURN ( _SEND8(self, aSelector, aClass, &ilc8,
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5714
                                argP[0], argP[1], argP[2], argP[3], argP[4], argP[5],
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5715
                                argP[6], argP[7]));
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5716
            }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5717
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5718
        case 9:
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5719
            {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5720
                static struct inlineCache ilc9 = __DUMMYILCSELF9(@line+1);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5721
                RETURN ( _SEND9(self, aSelector, aClass, &ilc9,
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5722
                                argP[0], argP[1], argP[2], argP[3], argP[4], argP[5],
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5723
                                argP[6], argP[7], argP[8]));
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5724
            }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5725
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5726
        case 10:
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5727
            {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5728
                static struct inlineCache ilc10 = __DUMMYILCSELF10(@line+1);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5729
                RETURN ( _SEND10(self, aSelector, aClass, &ilc10,
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5730
                                 argP[0], argP[1], argP[2], argP[3], argP[4], argP[5],
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5731
                                 argP[6], argP[7], argP[8], argP[9]));
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5732
            }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5733
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5734
        case 11:
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5735
            {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5736
                static struct inlineCache ilc11 = __DUMMYILCSELF11(@line+1);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5737
                RETURN ( _SEND11(self, aSelector, aClass, &ilc11,
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5738
                                 argP[0], argP[1], argP[2], argP[3], argP[4], argP[5],
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5739
                                 argP[6], argP[7], argP[8], argP[9], argP[10]));
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5740
            }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5741
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5742
        case 12:
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5743
            {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5744
                static struct inlineCache ilc12 = __DUMMYILCSELF12(@line+1);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5745
                RETURN ( _SEND12(self, aSelector, aClass, &ilc12,
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5746
                                 argP[0], argP[1], argP[2], argP[3], argP[4], argP[5],
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5747
                                 argP[6], argP[7], argP[8], argP[9], argP[10],
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5748
                                 argP[11]));
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5749
            }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5750
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5751
        case 13:
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5752
            {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5753
                static struct inlineCache ilc13 = __DUMMYILCSELF13(@line+1);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5754
                RETURN ( _SEND13(self, aSelector, aClass, &ilc13,
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5755
                                 argP[0], argP[1], argP[2], argP[3], argP[4], argP[5],
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5756
                                 argP[6], argP[7], argP[8], argP[9], argP[10],
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5757
                                 argP[11], argP[12]));
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5758
            }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5759
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5760
        case 14:
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5761
            {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5762
                static struct inlineCache ilc14 = __DUMMYILCSELF14(@line+1);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5763
                RETURN ( _SEND14(self, aSelector, aClass, &ilc14,
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5764
                                 argP[0], argP[1], argP[2], argP[3], argP[4], argP[5],
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5765
                                 argP[6], argP[7], argP[8], argP[9], argP[10],
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5766
                                 argP[11], argP[12], argP[13]));
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5767
            }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5768
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5769
        case 15:
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5770
            {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5771
                static struct inlineCache ilc15 = __DUMMYILCSELF15(@line+1);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5772
                RETURN ( _SEND15(self, aSelector, aClass, &ilc15,
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5773
                                 argP[0], argP[1], argP[2], argP[3], argP[4], argP[5],
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5774
                                 argP[6], argP[7], argP[8], argP[9], argP[10],
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5775
                                 argP[11], argP[12], argP[13], argP[14]));
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5776
            }
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5777
18231
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  5778
# ifdef _SEND16
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5779
        case 16:
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5780
            {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5781
                static struct inlineCache ilc16 = __DUMMYILCSELF16(@line+1);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5782
                RETURN ( _SEND16(self, aSelector, aClass, &ilc15,
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5783
                                 argP[0], argP[1], argP[2], argP[3], argP[4], argP[5],
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5784
                                 argP[6], argP[7], argP[8], argP[9], argP[10],
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5785
                                 argP[11], argP[12], argP[13], argP[14], argP[15]));
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5786
            }
18231
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  5787
# endif
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  5788
# ifdef _SEND17
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5789
        case 17:
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5790
            {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5791
                static struct inlineCache ilc17 = __DUMMYILCSELF17(@line+1);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5792
                RETURN ( _SEND17(self, aSelector, aClass, &ilc15,
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5793
                                 argP[0], argP[1], argP[2], argP[3], argP[4], argP[5],
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5794
                                 argP[6], argP[7], argP[8], argP[9], argP[10],
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5795
                                 argP[11], argP[12], argP[13], argP[14], argP[15], argP[16]));
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5796
            }
18231
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  5797
# endif
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5798
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5799
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5800
    }
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5801
bad:;
18240
28af09029a8b ifdef for SCHTEAM engine changed (not relevant for ST/X)
Claus Gittinger <cg@exept.de>
parents: 18238
diff changeset
  5802
#endif /* not __SCHTEAM__ */
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5803
%}.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5804
    "/ arrive here, if bad number of arguments (too many)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5805
    "/ ST/X (currently) only allows up to 15 method arguments
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5806
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5807
    ^ self primitiveFailed
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5808
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5809
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5810
perform:aSelector with:arg
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5811
    "send the one-arg-message aSelector to the receiver"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5812
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5813
%{
18240
28af09029a8b ifdef for SCHTEAM engine changed (not relevant for ST/X)
Claus Gittinger <cg@exept.de>
parents: 18238
diff changeset
  5814
#ifdef __SCHTEAM__
18238
0b3b5ced099d oops - sorry
Claus Gittinger <cg@exept.de>
parents: 18231
diff changeset
  5815
    return context.PERFORM_WITH(self, aSelector, arg);
18231
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  5816
#else
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5817
    REGISTER OBJ sel = aSelector;
16588
eb24b473a3ba Fix for bug in Object>>perform(with:(with:)) - care for nil or SmallInteger selectors.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16583
diff changeset
  5818
    int hash0;
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5819
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5820
    if (InterruptPending == nil) {
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5821
        struct inlineCache *pIlc;
18231
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  5822
# undef nways
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  5823
# define nways 2
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  5824
# undef nilcs
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  5825
# define nilcs 131
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  5826
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  5827
# define SEL_AND_ILC_INIT_1(l)   { { nil, nil } , { __ILCPERF1(l) , __ILCPERF1(l)  } , 0 }
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  5828
# define SEL_AND_ILC_INIT_2(l)   SEL_AND_ILC_INIT_1(l)   , SEL_AND_ILC_INIT_1(l)
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  5829
# define SEL_AND_ILC_INIT_4(l)   SEL_AND_ILC_INIT_2(l)   , SEL_AND_ILC_INIT_2(l)
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  5830
# define SEL_AND_ILC_INIT_8(l)   SEL_AND_ILC_INIT_4(l)   , SEL_AND_ILC_INIT_4(l)
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  5831
# define SEL_AND_ILC_INIT_16(l)  SEL_AND_ILC_INIT_8(l)   , SEL_AND_ILC_INIT_8(l)
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  5832
# define SEL_AND_ILC_INIT_32(l)  SEL_AND_ILC_INIT_16(l)  , SEL_AND_ILC_INIT_16(l)
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  5833
# define SEL_AND_ILC_INIT_32(l)  SEL_AND_ILC_INIT_16(l)  , SEL_AND_ILC_INIT_16(l)
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  5834
# define SEL_AND_ILC_INIT_64(l)  SEL_AND_ILC_INIT_32(l)  , SEL_AND_ILC_INIT_32(l)
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  5835
# define SEL_AND_ILC_INIT_128(l) SEL_AND_ILC_INIT_64(l)  , SEL_AND_ILC_INIT_64(l)
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  5836
# define SEL_AND_ILC_INIT_256(l) SEL_AND_ILC_INIT_128(l) , SEL_AND_ILC_INIT_128(l)
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  5837
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  5838
# define SEL_AND_ILC_INIT_131(l) SEL_AND_ILC_INIT_128(l) , SEL_AND_ILC_INIT_2(l) , SEL_AND_ILC_INIT_1(l)
16169
5a4e80279be4 Object>>#perform:(with:(with:)): more performant implementation
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16126
diff changeset
  5839
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5840
        static struct { OBJ sel[nways]; struct inlineCache ilc[nways]; int flip; } sel_and_ilc[nilcs] = { SEL_AND_ILC_INIT_131(@line) };
13416
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5841
18231
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  5842
# undef SEL_AND_ILC_INIT_1
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  5843
# undef SEL_AND_ILC_INIT_2
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  5844
# undef SEL_AND_ILC_INIT_4
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  5845
# undef SEL_AND_ILC_INIT_8
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  5846
# undef SEL_AND_ILC_INIT_16
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  5847
# undef SEL_AND_ILC_INIT_32
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  5848
# undef SEL_AND_ILC_INIT_64
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  5849
# undef SEL_AND_ILC_INIT_128
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  5850
# undef SEL_AND_ILC_INIT_256
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  5851
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  5852
# undef SEL_AND_ILC_INIT_131
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  5853
# undef SEL_AND_ILC_INIT_257
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  5854
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  5855
# define TRY(n)                                  \
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5856
        if (sel == sel_and_ilc[hash0].sel[n]) { \
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5857
            pIlc = &sel_and_ilc[hash0].ilc[n];  \
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5858
            goto perform1_send_and_return;      \
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5859
        }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5860
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5861
        if (__isNonNilObject(sel)) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5862
            hash0 = __MAKE_HASH__(__GET_HASH(sel)) % nilcs;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5863
        } else {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5864
            /* sel is either nil or smallint, use its value as hash */
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5865
            hash0 = (INT)sel % nilcs;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5866
        }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5867
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5868
        TRY(0);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5869
        TRY(1);
16169
5a4e80279be4 Object>>#perform:(with:(with:)): more performant implementation
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16126
diff changeset
  5870
18231
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  5871
# undef TRY
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5872
        /*printf("Object >> #perform: #%s --> no PIC found\n", __symbolVal(aSelector));*/
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5873
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5874
        pIlc = &sel_and_ilc[hash0].ilc[sel_and_ilc[hash0].flip];
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5875
        sel_and_ilc[hash0].sel[sel_and_ilc[hash0].flip] = sel;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5876
        sel_and_ilc[hash0].flip = (sel_and_ilc[hash0].flip + 1) % nways;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5877
        pIlc->ilc_func = __SEND1ADDR__;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5878
        if (pIlc->ilc_poly) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5879
            __flushPolyCache(pIlc->ilc_poly);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5880
            pIlc->ilc_poly = 0;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5881
        }
16169
5a4e80279be4 Object>>#perform:(with:(with:)): more performant implementation
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16126
diff changeset
  5882
13416
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5883
perform1_send_and_return:
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5884
        RETURN ( (*(pIlc->ilc_func))(self, sel, nil, pIlc, arg) );
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5885
    } else {
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5886
        static struct inlineCache ilc1 = __DUMMYILCSELF1(@line+1);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5887
        RETURN (_SEND1(self, aSelector, nil, &ilc1, arg));
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5888
    }
18240
28af09029a8b ifdef for SCHTEAM engine changed (not relevant for ST/X)
Claus Gittinger <cg@exept.de>
parents: 18238
diff changeset
  5889
#endif /* not __SCHTEAM__ */
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5890
%}.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5891
    ^ self perform:aSelector withArguments:(Array with:arg)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5892
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5893
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5894
perform:aSelector with:arg1 with:arg2
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5895
    "send the two-arg-message aSelector to the receiver"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5896
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5897
%{
18263
1fadeed7749f schteam stuff
Claus Gittinger <cg@exept.de>
parents: 18254
diff changeset
  5898
#ifdef __SCHTEAM__
1fadeed7749f schteam stuff
Claus Gittinger <cg@exept.de>
parents: 18254
diff changeset
  5899
    return context.PERFORM_WITH2(self, aSelector, arg1, arg2);
1fadeed7749f schteam stuff
Claus Gittinger <cg@exept.de>
parents: 18254
diff changeset
  5900
#else
13416
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5901
    REGISTER OBJ sel = aSelector;
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5902
    struct inlineCache *pIlc;
16588
eb24b473a3ba Fix for bug in Object>>perform(with:(with:)) - care for nil or SmallInteger selectors.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16583
diff changeset
  5903
    int hash0;
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5904
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5905
    if (InterruptPending == nil) {
18231
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  5906
# undef nways
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  5907
# define nways 2
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  5908
# undef nilcs
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  5909
# define nilcs 131
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  5910
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  5911
# define SEL_AND_ILC_INIT_1(l)   { { nil, nil } , { __ILCPERF2(l) , __ILCPERF2(l) } , 0 }
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  5912
# define SEL_AND_ILC_INIT_2(l)   SEL_AND_ILC_INIT_1(l)   , SEL_AND_ILC_INIT_1(l)
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  5913
# define SEL_AND_ILC_INIT_4(l)   SEL_AND_ILC_INIT_2(l)   , SEL_AND_ILC_INIT_2(l)
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  5914
# define SEL_AND_ILC_INIT_8(l)   SEL_AND_ILC_INIT_4(l)   , SEL_AND_ILC_INIT_4(l)
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  5915
# define SEL_AND_ILC_INIT_16(l)  SEL_AND_ILC_INIT_8(l)   , SEL_AND_ILC_INIT_8(l)
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  5916
# define SEL_AND_ILC_INIT_32(l)  SEL_AND_ILC_INIT_16(l)  , SEL_AND_ILC_INIT_16(l)
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  5917
# define SEL_AND_ILC_INIT_32(l)  SEL_AND_ILC_INIT_16(l)  , SEL_AND_ILC_INIT_16(l)
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  5918
# define SEL_AND_ILC_INIT_64(l)  SEL_AND_ILC_INIT_32(l)  , SEL_AND_ILC_INIT_32(l)
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  5919
# define SEL_AND_ILC_INIT_128(l) SEL_AND_ILC_INIT_64(l)  , SEL_AND_ILC_INIT_64(l)
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  5920
# define SEL_AND_ILC_INIT_256(l) SEL_AND_ILC_INIT_128(l) , SEL_AND_ILC_INIT_128(l)
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  5921
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  5922
# define SEL_AND_ILC_INIT_131(l) SEL_AND_ILC_INIT_128(l) , SEL_AND_ILC_INIT_2(l) , SEL_AND_ILC_INIT_1(l)
16169
5a4e80279be4 Object>>#perform:(with:(with:)): more performant implementation
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16126
diff changeset
  5923
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5924
        static struct { OBJ sel[nways]; struct inlineCache ilc[nways]; int flip; } sel_and_ilc[nilcs] = { SEL_AND_ILC_INIT_131(@line) };
13416
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5925
18231
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  5926
# undef SEL_AND_ILC_INIT_1
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  5927
# undef SEL_AND_ILC_INIT_2
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  5928
# undef SEL_AND_ILC_INIT_4
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  5929
# undef SEL_AND_ILC_INIT_8
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  5930
# undef SEL_AND_ILC_INIT_16
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  5931
# undef SEL_AND_ILC_INIT_32
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  5932
# undef SEL_AND_ILC_INIT_64
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  5933
# undef SEL_AND_ILC_INIT_128
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  5934
# undef SEL_AND_ILC_INIT_256
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  5935
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  5936
# undef SEL_AND_ILC_INIT_131
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  5937
# undef SEL_AND_ILC_INIT_257
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  5938
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  5939
# define TRY(n)                                  \
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5940
        if (sel == sel_and_ilc[hash0].sel[n]) { \
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5941
            pIlc = &sel_and_ilc[hash0].ilc[n];  \
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5942
            goto perform2_send_and_return;      \
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5943
        }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5944
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5945
        if (__isNonNilObject(sel)) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5946
            hash0 = __MAKE_HASH__(__GET_HASH(sel)) % nilcs;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5947
        } else {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5948
            /* sel is either nil or smallint, use its value as hash */
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5949
            hash0 = (INT)sel % nilcs;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5950
        }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5951
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5952
        TRY(0);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5953
        TRY(1);
16169
5a4e80279be4 Object>>#perform:(with:(with:)): more performant implementation
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16126
diff changeset
  5954
18231
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  5955
# undef TRY
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5956
        /*printf("Object >> #perform: #%s --> no PIC found\n", __symbolVal(aSelector));*/
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5957
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5958
        pIlc = &sel_and_ilc[hash0].ilc[sel_and_ilc[hash0].flip];
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5959
        sel_and_ilc[hash0].sel[sel_and_ilc[hash0].flip] = sel;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5960
        sel_and_ilc[hash0].flip = (sel_and_ilc[hash0].flip + 1) % nways;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5961
        pIlc->ilc_func = __SEND2ADDR__;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5962
        if (pIlc->ilc_poly) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5963
            __flushPolyCache(pIlc->ilc_poly);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5964
            pIlc->ilc_poly = 0;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5965
        }
16169
5a4e80279be4 Object>>#perform:(with:(with:)): more performant implementation
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16126
diff changeset
  5966
13416
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5967
perform2_send_and_return:
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5968
        RETURN ( (*(pIlc->ilc_func))(self, aSelector, nil, pIlc, arg1, arg2) );
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5969
    } else {
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5970
        static struct inlineCache ilc2 = __DUMMYILCSELF2(@line+1);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5971
        RETURN (_SEND2(self, aSelector, nil, &ilc2, arg1, arg2));
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5972
    }
18263
1fadeed7749f schteam stuff
Claus Gittinger <cg@exept.de>
parents: 18254
diff changeset
  5973
#endif /* not SCHTEAM */
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5974
%}.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5975
    ^ self perform:aSelector withArguments:(Array with:arg1 with:arg2)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5976
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5977
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5978
perform:aSelector with:arg1 with:arg2 with:arg3
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5979
    "send the three-arg-message aSelector to the receiver"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5980
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5981
%{
18263
1fadeed7749f schteam stuff
Claus Gittinger <cg@exept.de>
parents: 18254
diff changeset
  5982
#ifdef __SCHTEAM__
1fadeed7749f schteam stuff
Claus Gittinger <cg@exept.de>
parents: 18254
diff changeset
  5983
    return context.PERFORM_WITH3(self, aSelector, arg1, arg2, arg3);
1fadeed7749f schteam stuff
Claus Gittinger <cg@exept.de>
parents: 18254
diff changeset
  5984
#else
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5985
    struct inlineCache *pIlc;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5986
    static struct inlineCache ilc_0 = __ILCPERF3(@line);
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5987
    static struct inlineCache ilc_1 = __ILCPERF3(@line);
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5988
    static OBJ last_0 = nil;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5989
    static OBJ last_1 = nil;
18185
f454e3590ebc missing type in flip
Claus Gittinger <cg@exept.de>
parents: 18151
diff changeset
  5990
    static int flip = 0;
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5991
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5992
    if (InterruptPending == nil) {
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5993
        if (aSelector != last_0) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5994
            if (aSelector != last_1) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5995
                if (flip) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5996
                    pIlc = &ilc_0;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5997
                    flip = 0;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5998
                    last_0 = aSelector;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  5999
                } else {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6000
                    pIlc = &ilc_1;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6001
                    flip = 1;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6002
                    last_1 = aSelector;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6003
                }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6004
                pIlc->ilc_func = __SEND3ADDR__;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6005
                if (pIlc->ilc_poly) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6006
                    __flushPolyCache(pIlc->ilc_poly);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6007
                    pIlc->ilc_poly = 0;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6008
                }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6009
            } else {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6010
                pIlc = &ilc_1;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6011
            }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6012
        } else {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6013
            pIlc = &ilc_0;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6014
        }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6015
        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
  6016
    } else {
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6017
        static struct inlineCache ilc3 = __DUMMYILCSELF3(@line+1);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6018
        RETURN (_SEND3(self, aSelector, nil, &ilc3, arg1, arg2, arg3));
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6019
    }
18263
1fadeed7749f schteam stuff
Claus Gittinger <cg@exept.de>
parents: 18254
diff changeset
  6020
#endif /* not SCHTEAM */
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6021
%}.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6022
    ^ self perform:aSelector withArguments:(Array with:arg1 with:arg2 with:arg3)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6023
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6024
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6025
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6026
perform:aSelector with:arg1 with:arg2 with:arg3 with:arg4
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6027
    "send the four-arg-message aSelector to the receiver"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6028
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6029
%{
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6030
    struct inlineCache *pIlc;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6031
    static struct inlineCache ilc_0 = __ILCPERF4(@line);
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6032
    static struct inlineCache ilc_1 = __ILCPERF4(@line);
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6033
    static OBJ last_0 = nil;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6034
    static OBJ last_1 = nil;
18185
f454e3590ebc missing type in flip
Claus Gittinger <cg@exept.de>
parents: 18151
diff changeset
  6035
    static int flip = 0;
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6036
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6037
    if (InterruptPending == nil) {
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6038
        if (aSelector != last_0) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6039
            if (aSelector != last_1) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6040
                if (flip) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6041
                    pIlc = &ilc_0;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6042
                    flip = 0;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6043
                    last_0 = aSelector;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6044
                } else {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6045
                    pIlc = &ilc_1;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6046
                    flip = 1;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6047
                    last_1 = aSelector;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6048
                }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6049
                pIlc->ilc_func = __SEND4ADDR__;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6050
                if (pIlc->ilc_poly) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6051
                    __flushPolyCache(pIlc->ilc_poly);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6052
                    pIlc->ilc_poly = 0;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6053
                }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6054
            } else {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6055
                pIlc = &ilc_1;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6056
            }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6057
        } else {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6058
            pIlc = &ilc_0;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6059
        }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6060
        RETURN ( (*(pIlc->ilc_func))(self, aSelector, nil, pIlc,
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6061
                                     arg1, arg2, arg3, arg4) );
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6062
    } else {
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6063
        static struct inlineCache ilc4 = __DUMMYILCSELF4(@line+1);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6064
        RETURN (_SEND4(self, aSelector, nil, &ilc4,
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6065
                       arg1, arg2, arg3, arg4));
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6066
    }
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6067
%}.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6068
    ^ self 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
  6069
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6070
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6071
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6072
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
  6073
    "send the five-arg-message aSelector to the receiver"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6074
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6075
%{
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6076
    struct inlineCache *pIlc;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6077
    static struct inlineCache ilc_0 = __ILCPERF5(@line);
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6078
    static struct inlineCache ilc_1 = __ILCPERF5(@line);
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6079
    static OBJ last_0 = nil;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6080
    static OBJ last_1 = nil;
18185
f454e3590ebc missing type in flip
Claus Gittinger <cg@exept.de>
parents: 18151
diff changeset
  6081
    static int flip = 0;
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6082
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6083
    if (InterruptPending == nil) {
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6084
        if (aSelector != last_0) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6085
            if (aSelector != last_1) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6086
                if (flip) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6087
                    pIlc = &ilc_0;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6088
                    flip = 0;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6089
                    last_0 = aSelector;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6090
                } else {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6091
                    pIlc = &ilc_1;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6092
                    flip = 1;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6093
                    last_1 = aSelector;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6094
                }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6095
                pIlc->ilc_func = __SEND5ADDR__;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6096
                if (pIlc->ilc_poly) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6097
                    __flushPolyCache(pIlc->ilc_poly);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6098
                    pIlc->ilc_poly = 0;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6099
                }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6100
            } else {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6101
                pIlc = &ilc_1;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6102
            }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6103
        } else {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6104
            pIlc = &ilc_0;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6105
        }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6106
        RETURN ( (*(pIlc->ilc_func))(self, aSelector, nil, pIlc,
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6107
                                     arg1, arg2, arg3, arg4, arg5) );
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6108
    } else {
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6109
        static struct inlineCache ilc5 = __DUMMYILCSELF5(@line+1);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6110
        RETURN (_SEND5(self, aSelector, nil, &ilc5,
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6111
                       arg1, arg2, arg3, arg4, arg5));
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6112
    }
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6113
%}.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6114
    ^ self perform:aSelector withArguments:(Array with:arg1 with:arg2 with:arg3 with:arg4
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6115
                                                  with:arg5)
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6116
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6117
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6118
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6119
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
  6120
    "send the six-arg-message aSelector to the receiver"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6121
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6122
%{
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6123
    struct inlineCache *pIlc;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6124
    static struct inlineCache ilc_0 = __ILCPERF6(@line);
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6125
    static struct inlineCache ilc_1 = __ILCPERF6(@line);
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6126
    static OBJ last_0 = nil;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6127
    static OBJ last_1 = nil;
18185
f454e3590ebc missing type in flip
Claus Gittinger <cg@exept.de>
parents: 18151
diff changeset
  6128
    static int flip = 0;
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6129
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6130
    if (InterruptPending == nil) {
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6131
        if (aSelector != last_0) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6132
            if (aSelector != last_1) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6133
                if (flip) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6134
                    pIlc = &ilc_0;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6135
                    flip = 0;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6136
                    last_0 = aSelector;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6137
                } else {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6138
                    pIlc = &ilc_1;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6139
                    flip = 1;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6140
                    last_1 = aSelector;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6141
                }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6142
                pIlc->ilc_func = __SEND6ADDR__;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6143
                if (pIlc->ilc_poly) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6144
                    __flushPolyCache(pIlc->ilc_poly);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6145
                    pIlc->ilc_poly = 0;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6146
                }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6147
            } else {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6148
                pIlc = &ilc_1;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6149
            }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6150
        } else {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6151
            pIlc = &ilc_0;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6152
        }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6153
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6154
        RETURN ( (*(pIlc->ilc_func))(self, aSelector, nil, pIlc,
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6155
                                     arg1, arg2, arg3, arg4, arg5, arg6) );
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6156
    } else {
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6157
        static struct inlineCache ilc6 = __DUMMYILCSELF6(@line+1);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6158
        RETURN (_SEND6(self, aSelector, nil, &ilc6,
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6159
                       arg1, arg2, arg3, arg4, arg5, arg6));
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6160
    }
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6161
%}.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6162
    ^ self perform:aSelector withArguments:(Array with:arg1 with:arg2 with:arg3 with:arg4
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6163
                                                  with:arg5 with:arg6)
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6164
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6165
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6166
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6167
perform:aSelector withArguments:argArray
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  6168
    "send the message aSelector with all args taken from argArray
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6169
     to the receiver."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6170
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6171
    |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
  6172
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6173
%{
18240
28af09029a8b ifdef for SCHTEAM engine changed (not relevant for ST/X)
Claus Gittinger <cg@exept.de>
parents: 18238
diff changeset
  6174
#ifdef __SCHTEAM__
18238
0b3b5ced099d oops - sorry
Claus Gittinger <cg@exept.de>
parents: 18231
diff changeset
  6175
    return context.PERFORM_WITH_ARGUMENTS(self, aSelector, argArray);
0b3b5ced099d oops - sorry
Claus Gittinger <cg@exept.de>
parents: 18231
diff changeset
  6176
#else
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6177
    REGISTER OBJ *argP;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6178
    int nargs;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6179
    OBJ l;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6180
8934
32a063645991 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8930
diff changeset
  6181
    if (__isArrayLike(argArray)) {
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6182
        nargs = __arraySize(argArray);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6183
        argP = __arrayVal(argArray);
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6184
    } else {
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6185
        if (__isNonNilObject(argArray)) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6186
            static struct inlineCache ilcSize = __ILC0(@line);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6187
            int i;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6188
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6189
            numberOfArgs = (*ilcSize.ilc_func)(argArray, @symbol(size), nil, &ilcSize);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6190
            if (!__isSmallInteger(numberOfArgs))
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6191
                goto bad;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6192
            nargs = __intVal(numberOfArgs);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6193
            argP = (OBJ *)(&a1);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6194
            for (i=1; i <= nargs; i++) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6195
                *argP++ = __AT_(argArray, __mkSmallInteger(i));
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6196
            }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6197
            argP = (OBJ *)(&a1);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6198
        } else {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6199
            nargs = 0;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6200
        }
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6201
    }
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6202
    switch (nargs) {
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6203
        case 0:
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6204
            if (InterruptPending == nil) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6205
                static OBJ last0_0 = nil; static struct inlineCache ilc0_0 = __ILCPERF0(@line);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6206
                static OBJ last0_1 = nil; static struct inlineCache ilc0_1 = __ILCPERF0(@line);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6207
                static OBJ last0_2 = nil; static struct inlineCache ilc0_2 = __ILCPERF0(@line);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6208
                static OBJ last0_3 = nil; static struct inlineCache ilc0_3 = __ILCPERF0(@line);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6209
                static int flip0 = 0;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6210
                struct inlineCache *pIlc;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6211
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6212
                if (aSelector == last0_0) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6213
                    pIlc = &ilc0_0;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6214
                } else if (aSelector == last0_1) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6215
                    pIlc = &ilc0_1;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6216
                } else if (aSelector == last0_2) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6217
                    pIlc = &ilc0_2;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6218
                } else if (aSelector == last0_3) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6219
                    pIlc = &ilc0_3;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6220
                } else {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6221
                    if (flip0 == 0) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6222
                        pIlc = &ilc0_0;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6223
                        flip0 = 1;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6224
                        last0_0 = aSelector;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6225
                    } else if (flip0 == 1) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6226
                        pIlc = &ilc0_1;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6227
                        flip0 = 2;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6228
                        last0_1 = aSelector;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6229
                    } else if (flip0 == 2) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6230
                        pIlc = &ilc0_2;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6231
                        flip0 = 3;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6232
                        last0_2 = aSelector;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6233
                    } else {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6234
                        pIlc = &ilc0_3;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6235
                        flip0 = 0;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6236
                        last0_3 = aSelector;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6237
                    }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6238
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6239
                    pIlc->ilc_func = __SEND0ADDR__;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6240
                    if (pIlc->ilc_poly) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6241
                        __flushPolyCache(pIlc->ilc_poly);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6242
                        pIlc->ilc_poly = 0;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6243
                    }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6244
                }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6245
                RETURN ((*pIlc->ilc_func)(self, aSelector, nil, pIlc));
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6246
            } else {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6247
                static struct inlineCache ilc0 = __DUMMYILCSELF0(@line+1);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6248
                RETURN (_SEND0(self, aSelector, nil, &ilc0));
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6249
            }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6250
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6251
        case 1:
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6252
            if (InterruptPending == nil) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6253
                static OBJ last1_0 = nil; static struct inlineCache ilc1_0 = __ILCPERF1(@line);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6254
                static OBJ last1_1 = nil; static struct inlineCache ilc1_1 = __ILCPERF1(@line);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6255
                static OBJ last1_2 = nil; static struct inlineCache ilc1_2 = __ILCPERF1(@line);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6256
                static OBJ last1_3 = nil; static struct inlineCache ilc1_3 = __ILCPERF1(@line);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6257
                static int flip1 = 0;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6258
                struct inlineCache *pIlc;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6259
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6260
                if (aSelector == last1_0) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6261
                    pIlc = &ilc1_0;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6262
                } else if (aSelector == last1_1) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6263
                    pIlc = &ilc1_1;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6264
                } else if (aSelector == last1_2) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6265
                    pIlc = &ilc1_2;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6266
                } else if (aSelector == last1_3) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6267
                    pIlc = &ilc1_3;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6268
                } else {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6269
                    if (flip1 == 0) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6270
                        pIlc = &ilc1_0;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6271
                        flip1 = 1;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6272
                        last1_0 = aSelector;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6273
                    } else if (flip1 == 1) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6274
                        pIlc = &ilc1_1;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6275
                        flip1 = 2;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6276
                        last1_1 = aSelector;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6277
                    } else if (flip1 == 2) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6278
                        pIlc = &ilc1_2;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6279
                        flip1 = 3;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6280
                        last1_2 = aSelector;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6281
                    } else {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6282
                        pIlc = &ilc1_3;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6283
                        flip1 = 0;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6284
                        last1_3 = aSelector;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6285
                    }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6286
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6287
                    pIlc->ilc_func = __SEND1ADDR__;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6288
                    if (pIlc->ilc_poly) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6289
                        __flushPolyCache(pIlc->ilc_poly);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6290
                        pIlc->ilc_poly = 0;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6291
                    }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6292
                }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6293
                RETURN ((*pIlc->ilc_func)(self, aSelector, nil, pIlc, argP[0]));
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6294
            } else {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6295
                static struct inlineCache ilc1 = __DUMMYILCSELF1(@line+1);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6296
                RETURN (_SEND1(self, aSelector, nil, &ilc1, argP[0]));
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6297
            }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6298
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6299
        case 2:
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6300
            if (InterruptPending == nil) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6301
                static OBJ last2_0 = nil; static struct inlineCache ilc2_0 = __ILCPERF2(@line);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6302
                static OBJ last2_1 = nil; static struct inlineCache ilc2_1 = __ILCPERF2(@line);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6303
                static int flip2 = 0;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6304
                struct inlineCache *pIlc;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6305
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6306
                if (aSelector == last2_0) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6307
                    pIlc = &ilc2_0;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6308
                } else if (aSelector == last2_1) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6309
                    pIlc = &ilc2_1;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6310
                } else {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6311
                    if (flip2 == 0) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6312
                        pIlc = &ilc2_0;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6313
                        flip2 = 1;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6314
                        last2_0 = aSelector;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6315
                    } else {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6316
                        pIlc = &ilc2_1;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6317
                        flip2 = 0;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6318
                        last2_1 = aSelector;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6319
                    }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6320
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6321
                    pIlc->ilc_func = __SEND2ADDR__;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6322
                    if (pIlc->ilc_poly) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6323
                        __flushPolyCache(pIlc->ilc_poly);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6324
                        pIlc->ilc_poly = 0;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6325
                    }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6326
                }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6327
                RETURN ((*pIlc->ilc_func)(self, aSelector, nil, pIlc, argP[0], argP[1]));
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6328
            } else {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6329
                static struct inlineCache ilc2 = __DUMMYILCSELF2(@line+1);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6330
                RETURN (_SEND2(self, aSelector, nil, &ilc2, argP[0], argP[1]));
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6331
            }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6332
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6333
        case 3:
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6334
            if (InterruptPending == nil) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6335
                static OBJ last3_0 = nil; static struct inlineCache ilc3_0 = __ILCPERF3(@line);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6336
                static OBJ last3_1 = nil; static struct inlineCache ilc3_1 = __ILCPERF3(@line);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6337
                static int flip3 = 0;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6338
                struct inlineCache *pIlc;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6339
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6340
                if (aSelector == last3_0) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6341
                    pIlc = &ilc3_0;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6342
                } else if (aSelector == last3_1) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6343
                    pIlc = &ilc3_1;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6344
                } else {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6345
                    if (flip3 == 0) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6346
                        pIlc = &ilc3_0;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6347
                        flip3 = 1;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6348
                        last3_0 = aSelector;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6349
                    } else {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6350
                        pIlc = &ilc3_1;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6351
                        flip3 = 0;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6352
                        last3_1 = aSelector;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6353
                    }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6354
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6355
                    pIlc->ilc_func = __SEND3ADDR__;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6356
                    if (pIlc->ilc_poly) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6357
                        __flushPolyCache(pIlc->ilc_poly);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6358
                        pIlc->ilc_poly = 0;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6359
                    }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6360
                }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6361
                RETURN ((*pIlc->ilc_func)(self, aSelector, nil, pIlc, argP[0], argP[1], argP[2]));
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6362
            } else {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6363
                static struct inlineCache ilc3 = __DUMMYILCSELF3(@line+1);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6364
                RETURN (_SEND3(self, aSelector, nil, &ilc3, argP[0], argP[1], argP[2]));
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6365
            }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6366
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6367
        case 4:
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6368
            {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6369
                static OBJ last4 = nil; static struct inlineCache ilc4 = __ILCPERF4(@line);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6370
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6371
                if ((InterruptPending != nil) || (aSelector != last4)) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6372
                    ilc4.ilc_func = __SEND4ADDR__;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6373
                    if (ilc4.ilc_poly) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6374
                        __flushPolyCache(ilc4.ilc_poly);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6375
                        ilc4.ilc_poly = 0;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6376
                    }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6377
                    last4 = aSelector;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6378
                }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6379
                RETURN ( (*ilc4.ilc_func)(self, aSelector, nil, &ilc4,
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6380
                                                argP[0], argP[1], argP[2], argP[3]));
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6381
            }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6382
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6383
        case 5:
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6384
            {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6385
                static OBJ last5 = nil; static struct inlineCache ilc5 = __ILCPERF5(@line);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6386
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6387
                if ((InterruptPending != nil) || (aSelector != last5)) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6388
                    ilc5.ilc_func = __SEND5ADDR__;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6389
                    if (ilc5.ilc_poly) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6390
                        __flushPolyCache(ilc5.ilc_poly);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6391
                        ilc5.ilc_poly = 0;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6392
                    }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6393
                    last5 = aSelector;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6394
                }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6395
                RETURN ( (*ilc5.ilc_func)(self, aSelector, nil, &ilc5,
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6396
                                                argP[0], argP[1], argP[2], argP[3], argP[4]));
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6397
            }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6398
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6399
        case 6:
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6400
            {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6401
                static OBJ last6 = nil; static struct inlineCache ilc6 = __ILCPERF6(@line);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6402
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6403
                if ((InterruptPending != nil) || (aSelector != last6)) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6404
                    ilc6.ilc_func = __SEND6ADDR__;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6405
                    if (ilc6.ilc_poly) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6406
                        __flushPolyCache(ilc6.ilc_poly);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6407
                        ilc6.ilc_poly = 0;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6408
                    }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6409
                    last6 = aSelector;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6410
                }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6411
                RETURN ( (*ilc6.ilc_func)(self, aSelector, nil, &ilc6,
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6412
                                                argP[0], argP[1], argP[2], argP[3], argP[4],
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6413
                                                argP[5]));
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6414
            }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6415
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6416
        case 7:
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6417
            {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6418
                static OBJ last7 = nil; static struct inlineCache ilc7 = __ILCPERF7(@line);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6419
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6420
                if ((InterruptPending != nil) || (aSelector != last7)) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6421
                    ilc7.ilc_func = __SEND7ADDR__;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6422
                    if (ilc7.ilc_poly) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6423
                        __flushPolyCache(ilc7.ilc_poly);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6424
                        ilc7.ilc_poly = 0;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6425
                    }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6426
                    last7 = aSelector;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6427
                }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6428
                RETURN ( (*ilc7.ilc_func)(self, aSelector, nil, &ilc7,
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6429
                                                argP[0], argP[1], argP[2], argP[3], argP[4],
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6430
                                                argP[5], argP[6]));
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6431
            }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6432
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6433
        case 8:
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6434
            {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6435
                static OBJ last8 = nil; static struct inlineCache ilc8 = __ILCPERF8(@line);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6436
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6437
                if ((InterruptPending != nil) || (aSelector != last8)) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6438
                    ilc8.ilc_func = __SEND8ADDR__;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6439
                    if (ilc8.ilc_poly) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6440
                        __flushPolyCache(ilc8.ilc_poly);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6441
                        ilc8.ilc_poly = 0;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6442
                    }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6443
                    last8 = aSelector;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6444
                }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6445
                RETURN ( (*ilc8.ilc_func)(self, aSelector, nil, &ilc8,
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6446
                                                argP[0], argP[1], argP[2], argP[3], argP[4],
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6447
                                                argP[5], argP[6], argP[7]));
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6448
            }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6449
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6450
        case 9:
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6451
            {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6452
                static OBJ last9 = nil; static struct inlineCache ilc9 = __ILCPERF9(@line);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6453
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6454
                if ((InterruptPending != nil) || (aSelector != last9)) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6455
                    ilc9.ilc_func = __SEND9ADDR__;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6456
                    if (ilc9.ilc_poly) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6457
                        __flushPolyCache(ilc9.ilc_poly);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6458
                        ilc9.ilc_poly = 0;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6459
                    }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6460
                    last9 = aSelector;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6461
                }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6462
                RETURN ( (*ilc9.ilc_func)(self, aSelector, nil, &ilc9,
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6463
                                                argP[0], argP[1], argP[2], argP[3], argP[4],
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6464
                                                argP[5], argP[6], argP[7], argP[8]));
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6465
            }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6466
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6467
        case 10:
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6468
            {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6469
                static OBJ last10 = nil; static struct inlineCache ilc10 = __ILCPERF10(@line);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6470
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6471
                if ((InterruptPending != nil) || (aSelector != last10)) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6472
                    ilc10.ilc_func = __SEND10ADDR__;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6473
                    if (ilc10.ilc_poly) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6474
                        __flushPolyCache(ilc10.ilc_poly);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6475
                        ilc10.ilc_poly = 0;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6476
                    }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6477
                    last10 = aSelector;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6478
                }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6479
                RETURN ( (*ilc10.ilc_func)(self, aSelector, nil, &ilc10,
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6480
                                                argP[0], argP[1], argP[2], argP[3], argP[4],
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6481
                                                argP[5], argP[6], argP[7], argP[8], argP[9]));
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6482
            }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6483
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6484
        case 11:
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6485
            {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6486
                static OBJ last11 = nil; static struct inlineCache ilc11 = __ILCPERF11(@line);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6487
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6488
                if ((InterruptPending != nil) || (aSelector != last11)) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6489
                    ilc11.ilc_func = __SEND11ADDR__;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6490
                    if (ilc11.ilc_poly) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6491
                        __flushPolyCache(ilc11.ilc_poly);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6492
                        ilc11.ilc_poly = 0;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6493
                    }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6494
                    last11 = aSelector;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6495
                }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6496
                RETURN ( (*ilc11.ilc_func)(self, aSelector, nil, &ilc11,
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6497
                                                argP[0], argP[1], argP[2], argP[3], argP[4],
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6498
                                                argP[5], argP[6], argP[7], argP[8], argP[9],
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6499
                                                argP[10]));
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6500
            }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6501
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6502
        case 12:
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6503
            {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6504
                static OBJ last12 = nil; static struct inlineCache ilc12 = __ILCPERF12(@line);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6505
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6506
                if ((InterruptPending != nil) || (aSelector != last12)) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6507
                    ilc12.ilc_func = __SEND12ADDR__;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6508
                    if (ilc12.ilc_poly) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6509
                        __flushPolyCache(ilc12.ilc_poly);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6510
                        ilc12.ilc_poly = 0;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6511
                    }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6512
                    last12 = aSelector;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6513
                }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6514
                RETURN ( (*ilc12.ilc_func)(self, aSelector, nil, &ilc12,
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6515
                                                argP[0], argP[1], argP[2], argP[3], argP[4],
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6516
                                                argP[5], argP[6], argP[7], argP[8], argP[9],
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6517
                                                argP[10], argP[11]));
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6518
            }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6519
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6520
        case 13:
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6521
            {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6522
                static OBJ last13 = nil; static struct inlineCache ilc13 = __ILCPERF13(@line);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6523
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6524
                if ((InterruptPending != nil) || (aSelector != last13)) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6525
                    ilc13.ilc_func = __SEND13ADDR__;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6526
                    if (ilc13.ilc_poly) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6527
                        __flushPolyCache(ilc13.ilc_poly);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6528
                        ilc13.ilc_poly = 0;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6529
                    }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6530
                    last13 = aSelector;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6531
                }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6532
                RETURN ( (*ilc13.ilc_func)(self, aSelector, nil, &ilc13,
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6533
                                                argP[0], argP[1], argP[2], argP[3], argP[4],
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6534
                                                argP[5], argP[6], argP[7], argP[8], argP[9],
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6535
                                                argP[10], argP[11], argP[12]));
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6536
            }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6537
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6538
        case 14:
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6539
            {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6540
                static OBJ last14 = nil; static struct inlineCache ilc14 = __ILCPERF14(@line);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6541
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6542
                if ((InterruptPending != nil) || (aSelector != last14)) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6543
                    ilc14.ilc_func = __SEND14ADDR__;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6544
                    if (ilc14.ilc_poly) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6545
                        __flushPolyCache(ilc14.ilc_poly);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6546
                        ilc14.ilc_poly = 0;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6547
                    }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6548
                    last14 = aSelector;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6549
                }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6550
                RETURN ( (*ilc14.ilc_func)(self, aSelector, nil, &ilc14,
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6551
                                                argP[0], argP[1], argP[2], argP[3], argP[4],
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6552
                                                argP[5], argP[6], argP[7], argP[8], argP[9],
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6553
                                                argP[10], argP[11], argP[12], argP[13]));
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6554
            }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6555
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6556
        case 15:
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6557
            {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6558
                static OBJ last15 = nil; static struct inlineCache ilc15 = __ILCPERF15(@line);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6559
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6560
                if ((InterruptPending != nil) || (aSelector != last15)) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6561
                    ilc15.ilc_func = __SEND15ADDR__;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6562
                    if (ilc15.ilc_poly) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6563
                        __flushPolyCache(ilc15.ilc_poly);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6564
                        ilc15.ilc_poly = 0;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6565
                    }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6566
                    last15 = aSelector;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6567
                }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6568
                RETURN ( (*ilc15.ilc_func)(self, aSelector, nil, &ilc15,
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6569
                                                argP[0], argP[1], argP[2], argP[3], argP[4],
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6570
                                                argP[5], argP[6], argP[7], argP[8], argP[9],
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6571
                                                argP[10], argP[11], argP[12], argP[13],
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6572
                                                argP[14]));
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6573
            }
5755
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
bad:;
18238
0b3b5ced099d oops - sorry
Claus Gittinger <cg@exept.de>
parents: 18231
diff changeset
  6576
#endif
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6577
%}.
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
    "/ arrive here, if bad number of arguments (too many)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6580
    "/ ST/X (currently) only allows up to 15 method arguments
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 primitiveFailed
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
6316
345f36d2fc65 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6263
diff changeset
  6585
perform:aSelector withOptionalArgument:arg
345f36d2fc65 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6263
diff changeset
  6586
    "send aSelector-message to the receiver.
6318
3677d346113a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  6587
     If the message expects an argument, pass arg."
6316
345f36d2fc65 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6263
diff changeset
  6588
18440
dc5cde224664 class: Object
Stefan Vogel <sv@exept.de>
parents: 18422
diff changeset
  6589
    aSelector argumentCount == 1 ifTrue:[
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6590
        ^ self perform:aSelector with:arg
6316
345f36d2fc65 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6263
diff changeset
  6591
    ].
345f36d2fc65 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6263
diff changeset
  6592
    ^ self perform:aSelector
6319
75252ef51b38 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6318
diff changeset
  6593
75252ef51b38 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6318
diff changeset
  6594
    "
75252ef51b38 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6318
diff changeset
  6595
     |rec sel|
75252ef51b38 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6318
diff changeset
  6596
75252ef51b38 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6318
diff changeset
  6597
     rec := -1.
75252ef51b38 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6318
diff changeset
  6598
     sel := #abs.
75252ef51b38 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6318
diff changeset
  6599
     rec perform:sel withOptionalArgument:2.
75252ef51b38 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6318
diff changeset
  6600
75252ef51b38 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6318
diff changeset
  6601
     sel := #max:.
75252ef51b38 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6318
diff changeset
  6602
     rec perform:sel withOptionalArgument:2.
75252ef51b38 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6318
diff changeset
  6603
    "
6316
345f36d2fc65 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6263
diff changeset
  6604
!
345f36d2fc65 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6263
diff changeset
  6605
6321
8af99331b6e8 #perform:withOptionalArgument:and:
Claus Gittinger <cg@exept.de>
parents: 6319
diff changeset
  6606
perform:aSelector withOptionalArgument:optionalArg1 and:optionalArg2
8af99331b6e8 #perform:withOptionalArgument:and:
Claus Gittinger <cg@exept.de>
parents: 6319
diff changeset
  6607
    "send aSelector-message to the receiver.
6728
a4fc441779dc with 3 OptionalArguments
Claus Gittinger <cg@exept.de>
parents: 6721
diff changeset
  6608
     Depending on the number of arguments the message expects,
a4fc441779dc with 3 OptionalArguments
Claus Gittinger <cg@exept.de>
parents: 6721
diff changeset
  6609
     pass either none, 1, or 2 arguments."
6321
8af99331b6e8 #perform:withOptionalArgument:and:
Claus Gittinger <cg@exept.de>
parents: 6319
diff changeset
  6610
8af99331b6e8 #perform:withOptionalArgument:and:
Claus Gittinger <cg@exept.de>
parents: 6319
diff changeset
  6611
    |numArgs|
8af99331b6e8 #perform:withOptionalArgument:and:
Claus Gittinger <cg@exept.de>
parents: 6319
diff changeset
  6612
18440
dc5cde224664 class: Object
Stefan Vogel <sv@exept.de>
parents: 18422
diff changeset
  6613
    numArgs := aSelector argumentCount.
6321
8af99331b6e8 #perform:withOptionalArgument:and:
Claus Gittinger <cg@exept.de>
parents: 6319
diff changeset
  6614
    numArgs == 0 ifTrue:[
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6615
        ^ self perform:aSelector
6321
8af99331b6e8 #perform:withOptionalArgument:and:
Claus Gittinger <cg@exept.de>
parents: 6319
diff changeset
  6616
    ].
8af99331b6e8 #perform:withOptionalArgument:and:
Claus Gittinger <cg@exept.de>
parents: 6319
diff changeset
  6617
    numArgs == 1 ifTrue:[
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6618
        ^ self perform:aSelector with:optionalArg1
6321
8af99331b6e8 #perform:withOptionalArgument:and:
Claus Gittinger <cg@exept.de>
parents: 6319
diff changeset
  6619
    ].
8af99331b6e8 #perform:withOptionalArgument:and:
Claus Gittinger <cg@exept.de>
parents: 6319
diff changeset
  6620
    ^ self perform:aSelector with:optionalArg1 with:optionalArg2.
8af99331b6e8 #perform:withOptionalArgument:and:
Claus Gittinger <cg@exept.de>
parents: 6319
diff changeset
  6621
8af99331b6e8 #perform:withOptionalArgument:and:
Claus Gittinger <cg@exept.de>
parents: 6319
diff changeset
  6622
    "
8af99331b6e8 #perform:withOptionalArgument:and:
Claus Gittinger <cg@exept.de>
parents: 6319
diff changeset
  6623
     |rec sel|
8af99331b6e8 #perform:withOptionalArgument:and:
Claus Gittinger <cg@exept.de>
parents: 6319
diff changeset
  6624
8af99331b6e8 #perform:withOptionalArgument:and:
Claus Gittinger <cg@exept.de>
parents: 6319
diff changeset
  6625
     rec := -1.
8af99331b6e8 #perform:withOptionalArgument:and:
Claus Gittinger <cg@exept.de>
parents: 6319
diff changeset
  6626
     sel := #abs.
8af99331b6e8 #perform:withOptionalArgument:and:
Claus Gittinger <cg@exept.de>
parents: 6319
diff changeset
  6627
     rec perform:sel withOptionalArgument:2.
8af99331b6e8 #perform:withOptionalArgument:and:
Claus Gittinger <cg@exept.de>
parents: 6319
diff changeset
  6628
8af99331b6e8 #perform:withOptionalArgument:and:
Claus Gittinger <cg@exept.de>
parents: 6319
diff changeset
  6629
     sel := #max:.
8af99331b6e8 #perform:withOptionalArgument:and:
Claus Gittinger <cg@exept.de>
parents: 6319
diff changeset
  6630
     rec perform:sel withOptionalArgument:2.
8af99331b6e8 #perform:withOptionalArgument:and:
Claus Gittinger <cg@exept.de>
parents: 6319
diff changeset
  6631
    "
8af99331b6e8 #perform:withOptionalArgument:and:
Claus Gittinger <cg@exept.de>
parents: 6319
diff changeset
  6632
!
8af99331b6e8 #perform:withOptionalArgument:and:
Claus Gittinger <cg@exept.de>
parents: 6319
diff changeset
  6633
6728
a4fc441779dc with 3 OptionalArguments
Claus Gittinger <cg@exept.de>
parents: 6721
diff changeset
  6634
perform:aSelector withOptionalArgument:optionalArg1 and:optionalArg2 and:optionalArg3
a4fc441779dc with 3 OptionalArguments
Claus Gittinger <cg@exept.de>
parents: 6721
diff changeset
  6635
    "send aSelector-message to the receiver.
a4fc441779dc with 3 OptionalArguments
Claus Gittinger <cg@exept.de>
parents: 6721
diff changeset
  6636
     Depending on the number of arguments the message expects,
a4fc441779dc with 3 OptionalArguments
Claus Gittinger <cg@exept.de>
parents: 6721
diff changeset
  6637
     pass either none, 1, 2 or 3 arguments."
a4fc441779dc with 3 OptionalArguments
Claus Gittinger <cg@exept.de>
parents: 6721
diff changeset
  6638
a4fc441779dc with 3 OptionalArguments
Claus Gittinger <cg@exept.de>
parents: 6721
diff changeset
  6639
    |numArgs|
a4fc441779dc with 3 OptionalArguments
Claus Gittinger <cg@exept.de>
parents: 6721
diff changeset
  6640
18440
dc5cde224664 class: Object
Stefan Vogel <sv@exept.de>
parents: 18422
diff changeset
  6641
    numArgs := aSelector argumentCount.
6728
a4fc441779dc with 3 OptionalArguments
Claus Gittinger <cg@exept.de>
parents: 6721
diff changeset
  6642
    numArgs == 0 ifTrue:[
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6643
        ^ self perform:aSelector
6728
a4fc441779dc with 3 OptionalArguments
Claus Gittinger <cg@exept.de>
parents: 6721
diff changeset
  6644
    ].
a4fc441779dc with 3 OptionalArguments
Claus Gittinger <cg@exept.de>
parents: 6721
diff changeset
  6645
    numArgs == 1 ifTrue:[
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6646
        ^ self perform:aSelector with:optionalArg1
6728
a4fc441779dc with 3 OptionalArguments
Claus Gittinger <cg@exept.de>
parents: 6721
diff changeset
  6647
    ].
a4fc441779dc with 3 OptionalArguments
Claus Gittinger <cg@exept.de>
parents: 6721
diff changeset
  6648
    numArgs == 2 ifTrue:[
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6649
        ^ self perform:aSelector with:optionalArg1 with:optionalArg2
6728
a4fc441779dc with 3 OptionalArguments
Claus Gittinger <cg@exept.de>
parents: 6721
diff changeset
  6650
    ].
a4fc441779dc with 3 OptionalArguments
Claus Gittinger <cg@exept.de>
parents: 6721
diff changeset
  6651
    ^ self perform:aSelector with:optionalArg1 with:optionalArg2 with:optionalArg3.
a4fc441779dc with 3 OptionalArguments
Claus Gittinger <cg@exept.de>
parents: 6721
diff changeset
  6652
a4fc441779dc with 3 OptionalArguments
Claus Gittinger <cg@exept.de>
parents: 6721
diff changeset
  6653
    "
a4fc441779dc with 3 OptionalArguments
Claus Gittinger <cg@exept.de>
parents: 6721
diff changeset
  6654
     |rec sel|
a4fc441779dc with 3 OptionalArguments
Claus Gittinger <cg@exept.de>
parents: 6721
diff changeset
  6655
a4fc441779dc with 3 OptionalArguments
Claus Gittinger <cg@exept.de>
parents: 6721
diff changeset
  6656
     rec := -1.
a4fc441779dc with 3 OptionalArguments
Claus Gittinger <cg@exept.de>
parents: 6721
diff changeset
  6657
     sel := #abs.
a4fc441779dc with 3 OptionalArguments
Claus Gittinger <cg@exept.de>
parents: 6721
diff changeset
  6658
     rec perform:sel withOptionalArgument:2.
a4fc441779dc with 3 OptionalArguments
Claus Gittinger <cg@exept.de>
parents: 6721
diff changeset
  6659
a4fc441779dc with 3 OptionalArguments
Claus Gittinger <cg@exept.de>
parents: 6721
diff changeset
  6660
     sel := #max:.
a4fc441779dc with 3 OptionalArguments
Claus Gittinger <cg@exept.de>
parents: 6721
diff changeset
  6661
     rec perform:sel withOptionalArgument:2.
a4fc441779dc with 3 OptionalArguments
Claus Gittinger <cg@exept.de>
parents: 6721
diff changeset
  6662
    "
a4fc441779dc with 3 OptionalArguments
Claus Gittinger <cg@exept.de>
parents: 6721
diff changeset
  6663
!
a4fc441779dc with 3 OptionalArguments
Claus Gittinger <cg@exept.de>
parents: 6721
diff changeset
  6664
6764
c5455cf45678 perform:withOptional*
Claus Gittinger <cg@exept.de>
parents: 6741
diff changeset
  6665
perform:aSelector withOptionalArgument:optionalArg1 and:optionalArg2 and:optionalArg3 and:optionalArg4
c5455cf45678 perform:withOptional*
Claus Gittinger <cg@exept.de>
parents: 6741
diff changeset
  6666
    "send aSelector-message to the receiver.
c5455cf45678 perform:withOptional*
Claus Gittinger <cg@exept.de>
parents: 6741
diff changeset
  6667
     Depending on the number of arguments the message expects,
c5455cf45678 perform:withOptional*
Claus Gittinger <cg@exept.de>
parents: 6741
diff changeset
  6668
     pass either none, 1, 2, 3 or 4 arguments."
c5455cf45678 perform:withOptional*
Claus Gittinger <cg@exept.de>
parents: 6741
diff changeset
  6669
c5455cf45678 perform:withOptional*
Claus Gittinger <cg@exept.de>
parents: 6741
diff changeset
  6670
    |numArgs|
c5455cf45678 perform:withOptional*
Claus Gittinger <cg@exept.de>
parents: 6741
diff changeset
  6671
18440
dc5cde224664 class: Object
Stefan Vogel <sv@exept.de>
parents: 18422
diff changeset
  6672
    numArgs := aSelector argumentCount.
6764
c5455cf45678 perform:withOptional*
Claus Gittinger <cg@exept.de>
parents: 6741
diff changeset
  6673
    numArgs == 0 ifTrue:[
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6674
        ^ self perform:aSelector
6764
c5455cf45678 perform:withOptional*
Claus Gittinger <cg@exept.de>
parents: 6741
diff changeset
  6675
    ].
c5455cf45678 perform:withOptional*
Claus Gittinger <cg@exept.de>
parents: 6741
diff changeset
  6676
    numArgs == 1 ifTrue:[
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6677
        ^ self perform:aSelector with:optionalArg1
6764
c5455cf45678 perform:withOptional*
Claus Gittinger <cg@exept.de>
parents: 6741
diff changeset
  6678
    ].
c5455cf45678 perform:withOptional*
Claus Gittinger <cg@exept.de>
parents: 6741
diff changeset
  6679
    numArgs == 2 ifTrue:[
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6680
        ^ self perform:aSelector with:optionalArg1 with:optionalArg2
6764
c5455cf45678 perform:withOptional*
Claus Gittinger <cg@exept.de>
parents: 6741
diff changeset
  6681
    ].
c5455cf45678 perform:withOptional*
Claus Gittinger <cg@exept.de>
parents: 6741
diff changeset
  6682
    numArgs == 3 ifTrue:[
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6683
        ^ self perform:aSelector with:optionalArg1 with:optionalArg2 with:optionalArg3
6764
c5455cf45678 perform:withOptional*
Claus Gittinger <cg@exept.de>
parents: 6741
diff changeset
  6684
    ].
c5455cf45678 perform:withOptional*
Claus Gittinger <cg@exept.de>
parents: 6741
diff changeset
  6685
    ^ self perform:aSelector with:optionalArg1 with:optionalArg2 with:optionalArg3 with:optionalArg4.
c5455cf45678 perform:withOptional*
Claus Gittinger <cg@exept.de>
parents: 6741
diff changeset
  6686
c5455cf45678 perform:withOptional*
Claus Gittinger <cg@exept.de>
parents: 6741
diff changeset
  6687
    "
c5455cf45678 perform:withOptional*
Claus Gittinger <cg@exept.de>
parents: 6741
diff changeset
  6688
     |rec sel|
c5455cf45678 perform:withOptional*
Claus Gittinger <cg@exept.de>
parents: 6741
diff changeset
  6689
c5455cf45678 perform:withOptional*
Claus Gittinger <cg@exept.de>
parents: 6741
diff changeset
  6690
     rec := -1.
c5455cf45678 perform:withOptional*
Claus Gittinger <cg@exept.de>
parents: 6741
diff changeset
  6691
     sel := #abs.
c5455cf45678 perform:withOptional*
Claus Gittinger <cg@exept.de>
parents: 6741
diff changeset
  6692
     rec perform:sel withOptionalArgument:2.
c5455cf45678 perform:withOptional*
Claus Gittinger <cg@exept.de>
parents: 6741
diff changeset
  6693
c5455cf45678 perform:withOptional*
Claus Gittinger <cg@exept.de>
parents: 6741
diff changeset
  6694
     sel := #max:.
c5455cf45678 perform:withOptional*
Claus Gittinger <cg@exept.de>
parents: 6741
diff changeset
  6695
     rec perform:sel withOptionalArgument:2.
c5455cf45678 perform:withOptional*
Claus Gittinger <cg@exept.de>
parents: 6741
diff changeset
  6696
    "
c5455cf45678 perform:withOptional*
Claus Gittinger <cg@exept.de>
parents: 6741
diff changeset
  6697
!
c5455cf45678 perform:withOptional*
Claus Gittinger <cg@exept.de>
parents: 6741
diff changeset
  6698
17524
4a059f9d1dee class: Object
Claus Gittinger <cg@exept.de>
parents: 17456
diff changeset
  6699
performMessage:aMessage
4a059f9d1dee class: Object
Claus Gittinger <cg@exept.de>
parents: 17456
diff changeset
  6700
    "Send aMessage, an object which provides a selector and arguments to the
4a059f9d1dee class: Object
Claus Gittinger <cg@exept.de>
parents: 17456
diff changeset
  6701
     receiver object.
4a059f9d1dee class: Object
Claus Gittinger <cg@exept.de>
parents: 17456
diff changeset
  6702
     Added for Ansi compatibility"
4a059f9d1dee class: Object
Claus Gittinger <cg@exept.de>
parents: 17456
diff changeset
  6703
4a059f9d1dee class: Object
Claus Gittinger <cg@exept.de>
parents: 17456
diff changeset
  6704
    ^ self perform:(aMessage selector) withArguments:(aMessage arguments).
4a059f9d1dee class: Object
Claus Gittinger <cg@exept.de>
parents: 17456
diff changeset
  6705
4a059f9d1dee class: Object
Claus Gittinger <cg@exept.de>
parents: 17456
diff changeset
  6706
    "
4a059f9d1dee class: Object
Claus Gittinger <cg@exept.de>
parents: 17456
diff changeset
  6707
     123 performMessage:(Message selector:#+ argument:100)
4a059f9d1dee class: Object
Claus Gittinger <cg@exept.de>
parents: 17456
diff changeset
  6708
    "
4a059f9d1dee class: Object
Claus Gittinger <cg@exept.de>
parents: 17456
diff changeset
  6709
!
4a059f9d1dee class: Object
Claus Gittinger <cg@exept.de>
parents: 17456
diff changeset
  6710
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6711
performMethod:aMethod
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6712
    "invoke aMethod on the receiver.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6713
     The method should be a zero-argument method.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6714
     This is a non-object-oriented entry, applying a method
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6715
     in a functional way on a receiver.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6716
     Warning:
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6717
         Take care for the method to be appropriate for the
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6718
         receiver - no checking is done by the VM."
5755
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
    ^ aMethod valueWithReceiver:self arguments:#()
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
     |mthd|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6724
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6725
     mthd := SmallInteger compiledMethodAt:#negated.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6726
     Transcript showCR:(1 performMethod:mthd)
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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6729
    "BAD USE example:
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6730
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6731
     |mthd|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6732
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6733
     mthd := Point compiledMethodAt:#x.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6734
     Transcript showCR:((1->2) performMethod:mthd)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6735
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6736
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6737
    "Modified: 31.7.1997 / 17:41:50 / cg"
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
performMethod:aMethod arguments:argumentArray
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6741
    "invoke aMethod on the receiver, passing an argumentArray.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6742
     The size of the argumentArray should match the number of args
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6743
     expected by the method.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6744
     This is a non-object-oriented entry, applying a method
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6745
     in a functional way on a receiver.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6746
     Warning:
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6747
         Take care for the method to be appropriate for the
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6748
         receiver - no checking is done by the VM."
5755
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
    ^ aMethod valueWithReceiver:self arguments:argumentArray
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6751
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6752
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6753
     |mthd|
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
     mthd := SmallInteger compiledMethodAt:#+.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6756
     Transcript showCR:(1 performMethod:mthd arguments:#(2))
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6757
    "
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
    "Created: 31.7.1997 / 17:46:31 / cg"
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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6762
performMethod:aMethod with:arg
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6763
    "invoke aMethod on the receiver, passing an argument.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6764
     The method should be a one-argument method.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6765
     This is a non-object-oriented entry, applying a method
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6766
     in a functional way on a receiver.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6767
     Warning:
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6768
         Take care for the method to be appropriate for the
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6769
         receiver - no checking is done by the VM."
5755
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
    ^ aMethod valueWithReceiver:self arguments:(Array with:arg)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6772
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6773
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6774
     |mthd|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6775
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6776
     mthd := SmallInteger compiledMethodAt:#+.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6777
     Transcript showCR:(1 performMethod:mthd with:2)
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
    "Modified: 31.7.1997 / 17:42:32 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6781
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6782
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6783
performMethod:aMethod with:arg1 with:arg2
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6784
    "invoke aMethod on the receiver, passing two arguments.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6785
     The method should be a two-argument method.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6786
     This is a non-object-oriented entry, applying a method
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6787
     in a functional way on a receiver.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6788
     Warning:
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6789
         Take care for the method to be appropriate for the
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6790
         receiver - no checking is done by the VM."
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6791
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6792
    ^ aMethod valueWithReceiver:self arguments:(Array with:arg1 with:arg2)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6793
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
     |mthd arr|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6796
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6797
     arr := Array new:1.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6798
     mthd := Array compiledMethodAt:#basicAt:put:.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6799
     arr performMethod:mthd with:1 with:'foo'.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6800
     Transcript showCR:arr
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6801
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6802
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6803
    "Modified: 31.7.1997 / 17:44:54 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6804
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6805
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6806
performMethod:aMethod with:arg1 with:arg2 with:arg3
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6807
    "invoke aMethod on the receiver, passing three arguments.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6808
     The method should be a three-argument method.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6809
     This is a non-object-oriented entry, applying a method
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6810
     in a functional way on a receiver.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6811
     Warning:
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6812
         Take care for the method to be appropriate for the
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6813
         receiver - no checking is done by the VM."
5755
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
    ^ aMethod valueWithReceiver:self arguments:(Array with:arg1 with:arg2 with:arg3)
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
    "Created: 31.7.1997 / 17:45:20 / cg"
15586
ac2e51b3000c class: Object
Claus Gittinger <cg@exept.de>
parents: 15519
diff changeset
  6818
!
ac2e51b3000c class: Object
Claus Gittinger <cg@exept.de>
parents: 15519
diff changeset
  6819
ac2e51b3000c class: Object
Claus Gittinger <cg@exept.de>
parents: 15519
diff changeset
  6820
performX:aSelector
18231
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  6821
    "send the message aSelector to the receiver
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  6822
     This is the original implementation of #perform, for reference (before Jan's changes for Ruby tuning)."
15586
ac2e51b3000c class: Object
Claus Gittinger <cg@exept.de>
parents: 15519
diff changeset
  6823
ac2e51b3000c class: Object
Claus Gittinger <cg@exept.de>
parents: 15519
diff changeset
  6824
    <resource: #skipInDebuggersWalkBack>
ac2e51b3000c class: Object
Claus Gittinger <cg@exept.de>
parents: 15519
diff changeset
  6825
ac2e51b3000c class: Object
Claus Gittinger <cg@exept.de>
parents: 15519
diff changeset
  6826
%{
ac2e51b3000c class: Object
Claus Gittinger <cg@exept.de>
parents: 15519
diff changeset
  6827
    REGISTER OBJ sel = aSelector;
ac2e51b3000c class: Object
Claus Gittinger <cg@exept.de>
parents: 15519
diff changeset
  6828
ac2e51b3000c class: Object
Claus Gittinger <cg@exept.de>
parents: 15519
diff changeset
  6829
    if (InterruptPending == nil) {
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6830
        struct inlineCache *pIlc;
15586
ac2e51b3000c class: Object
Claus Gittinger <cg@exept.de>
parents: 15519
diff changeset
  6831
ac2e51b3000c class: Object
Claus Gittinger <cg@exept.de>
parents: 15519
diff changeset
  6832
#define SEL_AND_ILC_INIT_1(l)   { nil , __ILCPERF0(l) }
ac2e51b3000c class: Object
Claus Gittinger <cg@exept.de>
parents: 15519
diff changeset
  6833
#define SEL_AND_ILC_INIT_2(l)   SEL_AND_ILC_INIT_1(l)   , SEL_AND_ILC_INIT_1(l)
ac2e51b3000c class: Object
Claus Gittinger <cg@exept.de>
parents: 15519
diff changeset
  6834
#define SEL_AND_ILC_INIT_4(l)   SEL_AND_ILC_INIT_2(l)   , SEL_AND_ILC_INIT_2(l)
ac2e51b3000c class: Object
Claus Gittinger <cg@exept.de>
parents: 15519
diff changeset
  6835
#define SEL_AND_ILC_INIT_8(l)   SEL_AND_ILC_INIT_4(l)   , SEL_AND_ILC_INIT_4(l)
ac2e51b3000c class: Object
Claus Gittinger <cg@exept.de>
parents: 15519
diff changeset
  6836
#define SEL_AND_ILC_INIT_16(l)  SEL_AND_ILC_INIT_8(l)   , SEL_AND_ILC_INIT_8(l)
ac2e51b3000c class: Object
Claus Gittinger <cg@exept.de>
parents: 15519
diff changeset
  6837
#define SEL_AND_ILC_INIT_32(l)  SEL_AND_ILC_INIT_16(l)  , SEL_AND_ILC_INIT_16(l)
ac2e51b3000c class: Object
Claus Gittinger <cg@exept.de>
parents: 15519
diff changeset
  6838
#define SEL_AND_ILC_INIT_32(l)  SEL_AND_ILC_INIT_16(l)  , SEL_AND_ILC_INIT_16(l)
ac2e51b3000c class: Object
Claus Gittinger <cg@exept.de>
parents: 15519
diff changeset
  6839
#define SEL_AND_ILC_INIT_64(l)  SEL_AND_ILC_INIT_32(l)  , SEL_AND_ILC_INIT_32(l)
ac2e51b3000c class: Object
Claus Gittinger <cg@exept.de>
parents: 15519
diff changeset
  6840
#define SEL_AND_ILC_INIT_128(l) SEL_AND_ILC_INIT_64(l)  , SEL_AND_ILC_INIT_64(l)
ac2e51b3000c class: Object
Claus Gittinger <cg@exept.de>
parents: 15519
diff changeset
  6841
#define SEL_AND_ILC_INIT_256(l) SEL_AND_ILC_INIT_128(l) , SEL_AND_ILC_INIT_128(l)
16230
e5de942a1a19 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 16229
diff changeset
  6842
#undef nilcs
15586
ac2e51b3000c class: Object
Claus Gittinger <cg@exept.de>
parents: 15519
diff changeset
  6843
#define nilcs 256
ac2e51b3000c class: Object
Claus Gittinger <cg@exept.de>
parents: 15519
diff changeset
  6844
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6845
        static struct sel_and_ilc {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6846
            OBJ sel;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6847
            struct inlineCache ilc;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6848
            struct sel_and_ilc *next;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6849
        } sel_and_ilc[nilcs] = { SEL_AND_ILC_INIT_256(29) };
15586
ac2e51b3000c class: Object
Claus Gittinger <cg@exept.de>
parents: 15519
diff changeset
  6850
ac2e51b3000c class: Object
Claus Gittinger <cg@exept.de>
parents: 15519
diff changeset
  6851
#undef SEL_AND_ILC_INIT_1
ac2e51b3000c class: Object
Claus Gittinger <cg@exept.de>
parents: 15519
diff changeset
  6852
#undef SEL_AND_ILC_INIT_2
ac2e51b3000c class: Object
Claus Gittinger <cg@exept.de>
parents: 15519
diff changeset
  6853
#undef SEL_AND_ILC_INIT_4
ac2e51b3000c class: Object
Claus Gittinger <cg@exept.de>
parents: 15519
diff changeset
  6854
#undef SEL_AND_ILC_INIT_8
ac2e51b3000c class: Object
Claus Gittinger <cg@exept.de>
parents: 15519
diff changeset
  6855
#undef SEL_AND_ILC_INIT_16
ac2e51b3000c class: Object
Claus Gittinger <cg@exept.de>
parents: 15519
diff changeset
  6856
#undef SEL_AND_ILC_INIT_32
ac2e51b3000c class: Object
Claus Gittinger <cg@exept.de>
parents: 15519
diff changeset
  6857
#undef SEL_AND_ILC_INIT_64
ac2e51b3000c class: Object
Claus Gittinger <cg@exept.de>
parents: 15519
diff changeset
  6858
#undef SEL_AND_ILC_INIT_128
ac2e51b3000c class: Object
Claus Gittinger <cg@exept.de>
parents: 15519
diff changeset
  6859
#undef SEL_AND_ILC_INIT_256
ac2e51b3000c class: Object
Claus Gittinger <cg@exept.de>
parents: 15519
diff changeset
  6860
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6861
        static struct sel_and_ilc *nextFree = sel_and_ilc;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6862
        static struct sel_and_ilc *lastUsed = 0;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6863
        int n;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6864
        struct sel_and_ilc *slot, *prev, *prevPrev;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6865
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6866
        for (n=0, slot = lastUsed, prev = prevPrev = 0; slot; n++, slot = slot->next) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6867
           if (sel == slot->sel) {
15942
a76da2251215 handle weak objects (with instances or non-WeakArray)
Claus Gittinger <cg@exept.de>
parents: 15932
diff changeset
  6868
#ifdef XXDEBUG
15586
ac2e51b3000c class: Object
Claus Gittinger <cg@exept.de>
parents: 15519
diff changeset
  6869
printf("cached slot %d (len=%d)\n", slot-sel_and_ilc, n);
15942
a76da2251215 handle weak objects (with instances or non-WeakArray)
Claus Gittinger <cg@exept.de>
parents: 15932
diff changeset
  6870
#endif
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6871
                pIlc = &(slot->ilc);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6872
                // move to front
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6873
                if (prev) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6874
                    prev->next = slot->next;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6875
                }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6876
                slot->next = lastUsed;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6877
                lastUsed = slot;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6878
                pIlc = &(slot->ilc);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6879
                goto perform0_send_and_return;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6880
           }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6881
           prevPrev = prev;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6882
           prev = slot;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6883
        }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6884
        // not recently used...
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6885
        if (nextFree) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6886
            // another free one
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6887
            slot = nextFree;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6888
            nextFree = nextFree + 1;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6889
            if (nextFree >= &(sel_and_ilc[nilcs])) nextFree = 0;
15942
a76da2251215 handle weak objects (with instances or non-WeakArray)
Claus Gittinger <cg@exept.de>
parents: 15932
diff changeset
  6890
#ifdef XXDEBUG
15586
ac2e51b3000c class: Object
Claus Gittinger <cg@exept.de>
parents: 15519
diff changeset
  6891
printf("new slot %d\n", slot-sel_and_ilc);
15942
a76da2251215 handle weak objects (with instances or non-WeakArray)
Claus Gittinger <cg@exept.de>
parents: 15932
diff changeset
  6892
#endif
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6893
        } else {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6894
            // no more for reuse - use least recently used
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6895
            slot = prev;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6896
            prevPrev->next = 0;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6897
            slot->next = lastUsed;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6898
            lastUsed = slot;
15942
a76da2251215 handle weak objects (with instances or non-WeakArray)
Claus Gittinger <cg@exept.de>
parents: 15932
diff changeset
  6899
#ifdef XXDEBUG
15586
ac2e51b3000c class: Object
Claus Gittinger <cg@exept.de>
parents: 15519
diff changeset
  6900
printf("reuse last slot %d\n", slot-sel_and_ilc);
15942
a76da2251215 handle weak objects (with instances or non-WeakArray)
Claus Gittinger <cg@exept.de>
parents: 15932
diff changeset
  6901
#endif
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6902
        }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6903
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6904
        /*printf("Object >> #perform: #%s --> no PIC found\n", __symbolVal(aSelector));*/
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6905
        pIlc = &(slot->ilc);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6906
        slot->sel = sel;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6907
        pIlc->ilc_func = __SEND0ADDR__;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6908
        if (pIlc->ilc_poly) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6909
             __flushPolyCache(pIlc->ilc_poly);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6910
            pIlc->ilc_poly = 0;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6911
        }
15586
ac2e51b3000c class: Object
Claus Gittinger <cg@exept.de>
parents: 15519
diff changeset
  6912
perform0_send_and_return:
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6913
        RETURN ( (*(pIlc->ilc_func))(self, sel, nil, pIlc) );
15586
ac2e51b3000c class: Object
Claus Gittinger <cg@exept.de>
parents: 15519
diff changeset
  6914
    } else {
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6915
        static struct inlineCache ilc0 = __DUMMYILCSELF0(@line+1);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6916
        RETURN (_SEND0(self, aSelector, nil, &ilc0));
15586
ac2e51b3000c class: Object
Claus Gittinger <cg@exept.de>
parents: 15519
diff changeset
  6917
    }
ac2e51b3000c class: Object
Claus Gittinger <cg@exept.de>
parents: 15519
diff changeset
  6918
%}.
ac2e51b3000c class: Object
Claus Gittinger <cg@exept.de>
parents: 15519
diff changeset
  6919
    ^ self perform:aSelector withArguments:#()
15797
4100230d57fa class: Object
Stefan Vogel <sv@exept.de>
parents: 15777
diff changeset
  6920
!
4100230d57fa class: Object
Stefan Vogel <sv@exept.de>
parents: 15777
diff changeset
  6921
4100230d57fa class: Object
Stefan Vogel <sv@exept.de>
parents: 15777
diff changeset
  6922
returnablePerform:aSelector with:arg
4100230d57fa class: Object
Stefan Vogel <sv@exept.de>
parents: 15777
diff changeset
  6923
    "send the one-arg-message aSelector to the receiver.
4100230d57fa class: Object
Stefan Vogel <sv@exept.de>
parents: 15777
diff changeset
  6924
     This is the same as #perform:with: but the context can return."
4100230d57fa class: Object
Stefan Vogel <sv@exept.de>
parents: 15777
diff changeset
  6925
4100230d57fa class: Object
Stefan Vogel <sv@exept.de>
parents: 15777
diff changeset
  6926
    <context: #return>
4100230d57fa class: Object
Stefan Vogel <sv@exept.de>
parents: 15777
diff changeset
  6927
%{
4100230d57fa class: Object
Stefan Vogel <sv@exept.de>
parents: 15777
diff changeset
  6928
    REGISTER OBJ sel = aSelector;
4100230d57fa class: Object
Stefan Vogel <sv@exept.de>
parents: 15777
diff changeset
  6929
4100230d57fa class: Object
Stefan Vogel <sv@exept.de>
parents: 15777
diff changeset
  6930
    if (InterruptPending == nil) {
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6931
        struct inlineCache *pIlc;
15797
4100230d57fa class: Object
Stefan Vogel <sv@exept.de>
parents: 15777
diff changeset
  6932
    /* JV @ 2010-22-07: To improve performance I use 256 ILCs instead
4100230d57fa class: Object
Stefan Vogel <sv@exept.de>
parents: 15777
diff changeset
  6933
       of default 4. For details, see comment in perform: */
4100230d57fa class: Object
Stefan Vogel <sv@exept.de>
parents: 15777
diff changeset
  6934
4100230d57fa class: Object
Stefan Vogel <sv@exept.de>
parents: 15777
diff changeset
  6935
#define SEL_AND_ILC_INIT_1(l)   { nil , __ILCPERF1(l) }
4100230d57fa class: Object
Stefan Vogel <sv@exept.de>
parents: 15777
diff changeset
  6936
#define SEL_AND_ILC_INIT_2(l)   SEL_AND_ILC_INIT_1(l)   , SEL_AND_ILC_INIT_1(l)
4100230d57fa class: Object
Stefan Vogel <sv@exept.de>
parents: 15777
diff changeset
  6937
#define SEL_AND_ILC_INIT_4(l)   SEL_AND_ILC_INIT_2(l)   , SEL_AND_ILC_INIT_2(l)
4100230d57fa class: Object
Stefan Vogel <sv@exept.de>
parents: 15777
diff changeset
  6938
#define SEL_AND_ILC_INIT_8(l)   SEL_AND_ILC_INIT_4(l)   , SEL_AND_ILC_INIT_4(l)
4100230d57fa class: Object
Stefan Vogel <sv@exept.de>
parents: 15777
diff changeset
  6939
#define SEL_AND_ILC_INIT_16(l)  SEL_AND_ILC_INIT_8(l)   , SEL_AND_ILC_INIT_8(l)
4100230d57fa class: Object
Stefan Vogel <sv@exept.de>
parents: 15777
diff changeset
  6940
#define SEL_AND_ILC_INIT_32(l)  SEL_AND_ILC_INIT_16(l)  , SEL_AND_ILC_INIT_16(l)
4100230d57fa class: Object
Stefan Vogel <sv@exept.de>
parents: 15777
diff changeset
  6941
#define SEL_AND_ILC_INIT_32(l)  SEL_AND_ILC_INIT_16(l)  , SEL_AND_ILC_INIT_16(l)
4100230d57fa class: Object
Stefan Vogel <sv@exept.de>
parents: 15777
diff changeset
  6942
#define SEL_AND_ILC_INIT_64(l)  SEL_AND_ILC_INIT_32(l)  , SEL_AND_ILC_INIT_32(l)
4100230d57fa class: Object
Stefan Vogel <sv@exept.de>
parents: 15777
diff changeset
  6943
#define SEL_AND_ILC_INIT_128(l) SEL_AND_ILC_INIT_64(l)  , SEL_AND_ILC_INIT_64(l)
4100230d57fa class: Object
Stefan Vogel <sv@exept.de>
parents: 15777
diff changeset
  6944
#define SEL_AND_ILC_INIT_256(l) SEL_AND_ILC_INIT_128(l) , SEL_AND_ILC_INIT_128(l)
16230
e5de942a1a19 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 16229
diff changeset
  6945
#undef nilcs
15797
4100230d57fa class: Object
Stefan Vogel <sv@exept.de>
parents: 15777
diff changeset
  6946
#define nilcs 256
4100230d57fa class: Object
Stefan Vogel <sv@exept.de>
parents: 15777
diff changeset
  6947
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6948
        static struct { OBJ sel; struct inlineCache ilc; } sel_and_ilc[nilcs] = { SEL_AND_ILC_INIT_256(29) };
15797
4100230d57fa class: Object
Stefan Vogel <sv@exept.de>
parents: 15777
diff changeset
  6949
4100230d57fa class: Object
Stefan Vogel <sv@exept.de>
parents: 15777
diff changeset
  6950
#undef SEL_AND_ILC_INIT_1
4100230d57fa class: Object
Stefan Vogel <sv@exept.de>
parents: 15777
diff changeset
  6951
#undef SEL_AND_ILC_INIT_2
4100230d57fa class: Object
Stefan Vogel <sv@exept.de>
parents: 15777
diff changeset
  6952
#undef SEL_AND_ILC_INIT_4
4100230d57fa class: Object
Stefan Vogel <sv@exept.de>
parents: 15777
diff changeset
  6953
#undef SEL_AND_ILC_INIT_8
4100230d57fa class: Object
Stefan Vogel <sv@exept.de>
parents: 15777
diff changeset
  6954
#undef SEL_AND_ILC_INIT_16
4100230d57fa class: Object
Stefan Vogel <sv@exept.de>
parents: 15777
diff changeset
  6955
#undef SEL_AND_ILC_INIT_32
4100230d57fa class: Object
Stefan Vogel <sv@exept.de>
parents: 15777
diff changeset
  6956
#undef SEL_AND_ILC_INIT_64
4100230d57fa class: Object
Stefan Vogel <sv@exept.de>
parents: 15777
diff changeset
  6957
#undef SEL_AND_ILC_INIT_128
4100230d57fa class: Object
Stefan Vogel <sv@exept.de>
parents: 15777
diff changeset
  6958
#undef SEL_AND_ILC_INIT_256
4100230d57fa class: Object
Stefan Vogel <sv@exept.de>
parents: 15777
diff changeset
  6959
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6960
        static int flip = 0;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6961
        int i;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6962
        for (i = 0; i < nilcs; i++) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6963
           if (sel == sel_and_ilc[i].sel) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6964
                pIlc = &sel_and_ilc[i].ilc;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6965
                goto perform1_send_and_return;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6966
           }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6967
        }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6968
        /*printf("Object >> #perform: #%s with: arg --> no PIC found\n", __symbolVal(aSelector));*/
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6969
        pIlc = &sel_and_ilc[flip].ilc;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6970
        sel_and_ilc[flip].sel = sel;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6971
        flip = (flip + 1) % nilcs;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6972
        pIlc->ilc_func = __SEND1ADDR__;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6973
        if (pIlc->ilc_poly) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6974
             __flushPolyCache(pIlc->ilc_poly);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6975
            pIlc->ilc_poly = 0;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6976
        }
15797
4100230d57fa class: Object
Stefan Vogel <sv@exept.de>
parents: 15777
diff changeset
  6977
perform1_send_and_return:
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6978
        RETURN ( (*(pIlc->ilc_func))(self, sel, nil, pIlc, arg) );
15797
4100230d57fa class: Object
Stefan Vogel <sv@exept.de>
parents: 15777
diff changeset
  6979
    } else {
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6980
        static struct inlineCache ilc1 = __DUMMYILCSELF1(@line+1);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  6981
        RETURN (_SEND1(self, aSelector, nil, &ilc1, arg));
15797
4100230d57fa class: Object
Stefan Vogel <sv@exept.de>
parents: 15777
diff changeset
  6982
    }
4100230d57fa class: Object
Stefan Vogel <sv@exept.de>
parents: 15777
diff changeset
  6983
%}.
4100230d57fa class: Object
Stefan Vogel <sv@exept.de>
parents: 15777
diff changeset
  6984
    ^ self perform:aSelector withArguments:(Array with:arg)
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6985
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6986
17677
4b68c0b48d73 class: Object
Claus Gittinger <cg@exept.de>
parents: 17590
diff changeset
  6987
!Object methodsFor:'misc ui support'!
4b68c0b48d73 class: Object
Claus Gittinger <cg@exept.de>
parents: 17590
diff changeset
  6988
4b68c0b48d73 class: Object
Claus Gittinger <cg@exept.de>
parents: 17590
diff changeset
  6989
browse
4b68c0b48d73 class: Object
Claus Gittinger <cg@exept.de>
parents: 17590
diff changeset
  6990
    "open a browser on the receiver's class"
4b68c0b48d73 class: Object
Claus Gittinger <cg@exept.de>
parents: 17590
diff changeset
  6991
4b68c0b48d73 class: Object
Claus Gittinger <cg@exept.de>
parents: 17590
diff changeset
  6992
    self class theNonMetaclass browse
4b68c0b48d73 class: Object
Claus Gittinger <cg@exept.de>
parents: 17590
diff changeset
  6993
4b68c0b48d73 class: Object
Claus Gittinger <cg@exept.de>
parents: 17590
diff changeset
  6994
    "
4b68c0b48d73 class: Object
Claus Gittinger <cg@exept.de>
parents: 17590
diff changeset
  6995
     10 browse
4b68c0b48d73 class: Object
Claus Gittinger <cg@exept.de>
parents: 17590
diff changeset
  6996
     Collection browse
4b68c0b48d73 class: Object
Claus Gittinger <cg@exept.de>
parents: 17590
diff changeset
  6997
     Collection class browse
4b68c0b48d73 class: Object
Claus Gittinger <cg@exept.de>
parents: 17590
diff changeset
  6998
    "
4b68c0b48d73 class: Object
Claus Gittinger <cg@exept.de>
parents: 17590
diff changeset
  6999
! !
4b68c0b48d73 class: Object
Claus Gittinger <cg@exept.de>
parents: 17590
diff changeset
  7000
10834
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  7001
!Object methodsFor:'object persistency'!
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  7002
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  7003
elementDescriptorFor:anAspectSymbol
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  7004
    "support for persistency:
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  7005
     answer a collection of associations containing the
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  7006
     objects state to be encoded for aspect.
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  7007
     Association key is the instance variable name or access selector,
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  7008
     association value is the contents of the instance variable.
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  7009
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  7010
     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
  7011
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  7012
    |ret|
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  7013
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  7014
    ret := 0.
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  7015
    anAspectSymbol notNil ifTrue:[
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  7016
        ret := self perform:anAspectSymbol ifNotUnderstood:[0].
10834
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  7017
    ].
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  7018
    ret == 0 ifTrue:[
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  7019
        ^ self elementDescriptorForNonNilInstanceVariables
10834
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  7020
    ].
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  7021
    ^ ret.
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  7022
!
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  7023
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  7024
elementDescriptorForInstanceVariables
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  7025
    "return all instance variables for visiting/encoding"
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  7026
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  7027
    ^ self elementDescriptorForInstanceVariablesMatching:[:val | true].
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  7028
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  7029
    "
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  7030
      #(1 2 3 nil true symbol) elementDescriptorForInstanceVariables
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  7031
      Dictionary new elementDescriptorForInstanceVariables
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  7032
      (5 @ nil) elementDescriptorForInstanceVariables
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  7033
    "
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  7034
!
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  7035
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  7036
elementDescriptorForInstanceVariablesMatching:aBlock
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  7037
    "return all instance variables which conform to aBlock, for encoding/visiting.
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  7038
     Indexed vars are all included."
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  7039
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  7040
    |instVarNames theClass children
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  7041
     instSize "{ Class: SmallInteger }"
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  7042
     varSize "{ Class: SmallInteger }"|
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  7043
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  7044
    theClass := self class.
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  7045
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  7046
    instSize := theClass instSize.
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  7047
    varSize := theClass isVariable ifTrue:[self basicSize] ifFalse:[0].
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  7048
    children := OrderedCollection new:(instSize + varSize).
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  7049
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  7050
    instVarNames := theClass allInstVarNames.
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  7051
    1 to:instSize do:[:i | |var|
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  7052
        var := self instVarAt:i.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  7053
        (aBlock value:var) ifTrue:[
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  7054
            children add:((instVarNames at:i) -> var)
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  7055
        ]
10834
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  7056
    ].
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  7057
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  7058
    varSize ~~ 0 ifTrue:[
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  7059
        1 to:varSize do:[:i |
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  7060
            children add:(i -> (self basicAt:i))
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  7061
        ]
10834
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  7062
    ].
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  7063
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  7064
    ^ children.
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  7065
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  7066
    "
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  7067
      #(1 2 3 nil true symbol) elementDescriptorForInstanceVariables
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  7068
      Dictionary new elementDescriptorForInstanceVariables
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  7069
      (5 @ nil) elementDescriptorForInstanceVariables
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  7070
    "
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  7071
!
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  7072
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  7073
elementDescriptorForNonNilInstanceVariables
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  7074
    "return all non-nil instance variables for visiting/encoding"
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  7075
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  7076
    ^ self elementDescriptorForInstanceVariablesMatching:[:val | val notNil].
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  7077
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  7078
    "
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  7079
      #(1 2 3 nil true symbol) elementDescriptorForNonNilInstanceVariables
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  7080
      Dictionary new elementDescriptorForNonNilInstanceVariables
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  7081
      (5 @ nil) elementDescriptorForNonNilInstanceVariables
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  7082
    "
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  7083
! !
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  7084
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7085
!Object methodsFor:'printing & storing'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7086
6235
8eacf62c458e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6221
diff changeset
  7087
basicPrintOn:aStream
19451
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  7088
    "append the receiver's className with an article to the argument, aStream"
6235
8eacf62c458e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6221
diff changeset
  7089
8eacf62c458e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6221
diff changeset
  7090
    aStream nextPutAll:self classNameWithArticle
8eacf62c458e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6221
diff changeset
  7091
!
8eacf62c458e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6221
diff changeset
  7092
18984
a811aef4aaf5 #BUGFIX
Stefan Vogel <sv@exept.de>
parents: 18894
diff changeset
  7093
basicStoreString
a811aef4aaf5 #BUGFIX
Stefan Vogel <sv@exept.de>
parents: 18894
diff changeset
  7094
    "defined here for compatibility with CharacterArray, which redefines this"
a811aef4aaf5 #BUGFIX
Stefan Vogel <sv@exept.de>
parents: 18894
diff changeset
  7095
a811aef4aaf5 #BUGFIX
Stefan Vogel <sv@exept.de>
parents: 18894
diff changeset
  7096
    ^ self storeString
a811aef4aaf5 #BUGFIX
Stefan Vogel <sv@exept.de>
parents: 18894
diff changeset
  7097
!
a811aef4aaf5 #BUGFIX
Stefan Vogel <sv@exept.de>
parents: 18894
diff changeset
  7098
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7099
className
14368
deb662b4664b comment/format in: #className
Claus Gittinger <cg@exept.de>
parents: 14355
diff changeset
  7100
    "return the classname of the receiver's class"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7101
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7102
    ^ self class name
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
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7105
     1 className
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  7106
     1 class className
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7107
     $a className
9105
1666cb465e3f comments
Stefan Vogel <sv@exept.de>
parents: 9071
diff changeset
  7108
     $a class className
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7109
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7110
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7111
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7112
classNameWithArticle
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7113
    "return a string consisting of classname preceeded by an article.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7114
     (dont expect me to write national variants for this ... :-)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7115
     If you have special preferences, redefine it ..."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7116
6829
db28715efb4d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6815
diff changeset
  7117
    | cls|
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7118
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7119
    (cls := self class) == self ifTrue:[
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  7120
        ^ 'a funny object'
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7121
    ].
14368
deb662b4664b comment/format in: #className
Claus Gittinger <cg@exept.de>
parents: 14355
diff changeset
  7122
    cls isNil ifTrue:[
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  7123
        ^ 'a nil-classes object'        "/ cannot happen
14368
deb662b4664b comment/format in: #className
Claus Gittinger <cg@exept.de>
parents: 14355
diff changeset
  7124
    ].
6829
db28715efb4d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6815
diff changeset
  7125
    ^ cls nameWithArticle
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7126
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7127
    "
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  7128
     1 classNameWithArticle
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  7129
     (1->2) classNameWithArticle
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7130
     XWorkstation basicNew classNameWithArticle
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  7131
     XWorkstation classNameWithArticle
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7132
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7133
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7134
    "Modified: 13.5.1996 / 12:16:14 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7135
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7136
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7137
errorPrint
12703
b87cc4993193 changed:
sr
parents: 12566
diff changeset
  7138
    "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
  7139
     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
  7140
     headless applications."
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7141
14165
b5bb4e9fde8c changed:
Stefan Vogel <sv@exept.de>
parents: 14162
diff changeset
  7142
    Stderr isNil ifTrue:[
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  7143
        "/ the following allows errorPrint to be used during
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  7144
        "/ the early init-phase, when no Stderr has been set up.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  7145
        "/ (depends on string to respond to #errorPrint)
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  7146
        self printString utf8Encoded errorPrint.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  7147
        ^ self.
14165
b5bb4e9fde8c changed:
Stefan Vogel <sv@exept.de>
parents: 14162
diff changeset
  7148
    ].
b5bb4e9fde8c changed:
Stefan Vogel <sv@exept.de>
parents: 14162
diff changeset
  7149
13350
8c7603161369 added: #withErrorStreamDo:
Claus Gittinger <cg@exept.de>
parents: 13320
diff changeset
  7150
    self withErrorStreamDo:[:s | self printOn:s].
8c7603161369 added: #withErrorStreamDo:
Claus Gittinger <cg@exept.de>
parents: 13320
diff changeset
  7151
8c7603161369 added: #withErrorStreamDo:
Claus Gittinger <cg@exept.de>
parents: 13320
diff changeset
  7152
    "Modified: / 21-04-2011 / 12:46:42 / cg"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7153
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7154
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7155
errorPrintCR
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7156
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7157
12703
b87cc4993193 changed:
sr
parents: 12566
diff changeset
  7158
    "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
  7159
     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
  7160
     headless applications."
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7161
14165
b5bb4e9fde8c changed:
Stefan Vogel <sv@exept.de>
parents: 14162
diff changeset
  7162
    Stderr isNil ifTrue:[
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  7163
        "/ the following allows errorPrintCR to be used during
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  7164
        "/ the early init-phase, when no Stderr has been set up.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  7165
        "/ (depends on string to respond to #errorPrintCR)
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  7166
        self printString utf8Encoded errorPrintCR.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  7167
        ^ self.
14165
b5bb4e9fde8c changed:
Stefan Vogel <sv@exept.de>
parents: 14162
diff changeset
  7168
    ].
b5bb4e9fde8c changed:
Stefan Vogel <sv@exept.de>
parents: 14162
diff changeset
  7169
13350
8c7603161369 added: #withErrorStreamDo:
Claus Gittinger <cg@exept.de>
parents: 13320
diff changeset
  7170
    self withErrorStreamDo:[:s | self printOn:s. s cr].
8c7603161369 added: #withErrorStreamDo:
Claus Gittinger <cg@exept.de>
parents: 13320
diff changeset
  7171
8c7603161369 added: #withErrorStreamDo:
Claus Gittinger <cg@exept.de>
parents: 13320
diff changeset
  7172
    "
8c7603161369 added: #withErrorStreamDo:
Claus Gittinger <cg@exept.de>
parents: 13320
diff changeset
  7173
     'hello' errorPrintCR
8c7603161369 added: #withErrorStreamDo:
Claus Gittinger <cg@exept.de>
parents: 13320
diff changeset
  7174
    "
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7175
10564
7d25403688ba dont errorPrint on Transcript when I am a system process.
Claus Gittinger <cg@exept.de>
parents: 10558
diff changeset
  7176
    "Created: / 20-05-1996 / 10:20:41 / cg"
13350
8c7603161369 added: #withErrorStreamDo:
Claus Gittinger <cg@exept.de>
parents: 13320
diff changeset
  7177
    "Modified: / 21-04-2011 / 12:47:13 / cg"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7178
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7179
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7180
errorPrintNL
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7181
    "{ Pragma: +optSpace }"
5893
f92054b38d3c Assign #obsolete resource to obsolete methods
Stefan Vogel <sv@exept.de>
parents: 5879
diff changeset
  7182
    <resource:#obsolete>
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7183
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7184
    "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
  7185
     Please use #errorPrintCR - this method exists for backward compatibility."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7186
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7187
    ^ self errorPrintCR
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7188
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7189
    "Modified: 20.5.1996 / 10:24:45 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7190
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7191
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7192
errorPrintNewline
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7193
    "{ Pragma: +optSpace }"
5893
f92054b38d3c Assign #obsolete resource to obsolete methods
Stefan Vogel <sv@exept.de>
parents: 5879
diff changeset
  7194
    <resource:#obsolete>
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7195
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7196
    "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
  7197
     Please use #errorPrintCR - this method exists for backward compatibility."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7198
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7199
    self errorPrintCR.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7200
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7201
    "Modified: 20.5.1996 / 10:24:38 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7202
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7203
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7204
infoPrint
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7205
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7206
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7207
    "print the receiver on the standard error stream.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7208
     This is meant for information messages which are not warnings
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7209
     or fatal messages.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7210
     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
  7211
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7212
    InfoPrinting == true ifTrue:[
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  7213
        self errorPrint
5755
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
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7216
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7217
infoPrintCR
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7218
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7219
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7220
    "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
  7221
     This is meant for information messages which are not warnings
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7222
     or fatal messages.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7223
     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
  7224
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7225
    InfoPrinting == true ifTrue:[
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  7226
        self errorPrintCR
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7227
    ]
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7228
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7229
    "Created: 20.5.1996 / 10:21:28 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7230
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7231
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7232
infoPrintNL
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7233
    "{ Pragma: +optSpace }"
5893
f92054b38d3c Assign #obsolete resource to obsolete methods
Stefan Vogel <sv@exept.de>
parents: 5879
diff changeset
  7234
    <resource:#obsolete>
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7235
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7236
    "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
  7237
     Please use #infoPrintCR - this method exists for backward compatibility."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7238
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7239
    ^ self infoPrintCR
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7240
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7241
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7242
print
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7243
    "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
  7244
19382
a471e303346c #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19340
diff changeset
  7245
    "/ the following allows print/printCR to be used during
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7246
    "/ the early init-phase, when no Stdout has been set up.
19382
a471e303346c #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19340
diff changeset
  7247
    "/ (depends on String to respond to #print, without recurring back to here)
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7248
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7249
    Stdout isNil ifTrue:[
19382
a471e303346c #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19340
diff changeset
  7250
        self printString utf8Encoded print.
a471e303346c #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19340
diff changeset
  7251
        ^ self
a471e303346c #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19340
diff changeset
  7252
    ].
a471e303346c #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19340
diff changeset
  7253
    self printOn:Processor activeProcess stdout
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7254
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7255
    "Modified: 4.11.1996 / 23:36:58 / cg"
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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7258
printCR
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7259
    "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
  7260
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7261
    "/ the following allows printCR to be used during
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7262
    "/ the early init-phase, when no Stdout has been set up.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7263
    "/ (depends on string to respond to #printCR)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7264
19382
a471e303346c #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19340
diff changeset
  7265
    |stdout|
a471e303346c #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19340
diff changeset
  7266
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7267
    Stdout isNil ifTrue:[
19382
a471e303346c #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19340
diff changeset
  7268
        self printString utf8Encoded printCR.
a471e303346c #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19340
diff changeset
  7269
        ^ self
a471e303346c #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19340
diff changeset
  7270
    ].
a471e303346c #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19340
diff changeset
  7271
    stdout := Processor activeProcess stdout.
a471e303346c #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19340
diff changeset
  7272
    self printOn:stdout.
a471e303346c #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19340
diff changeset
  7273
    stdout cr
5755
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
    "Created: 20.5.1996 / 10:21:37 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7276
    "Modified: 4.11.1996 / 23:37:06 / cg"
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
printNL
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7280
    "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
  7281
     This exists for GNU Smalltalk compatibility - please use #printCR."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7282
5893
f92054b38d3c Assign #obsolete resource to obsolete methods
Stefan Vogel <sv@exept.de>
parents: 5879
diff changeset
  7283
    <resource:#obsolete>
f92054b38d3c Assign #obsolete resource to obsolete methods
Stefan Vogel <sv@exept.de>
parents: 5879
diff changeset
  7284
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7285
    ^ self printCR
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7286
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7287
    "Modified: 20.5.1996 / 10:25:31 / cg"
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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7290
printNewline
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7291
    "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
  7292
     This exists for backward compatibility - please use #printCR."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7293
5893
f92054b38d3c Assign #obsolete resource to obsolete methods
Stefan Vogel <sv@exept.de>
parents: 5879
diff changeset
  7294
    <resource:#obsolete>
f92054b38d3c Assign #obsolete resource to obsolete methods
Stefan Vogel <sv@exept.de>
parents: 5879
diff changeset
  7295
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7296
    self printCR
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7297
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7298
    "Modified: 20.5.1996 / 10:25:46 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7299
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7300
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7301
printOn:aStream
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7302
    "append a user printed representation of the receiver to aStream.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7303
     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
  7304
19451
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  7305
     The default here is to output the receiver's class name.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7306
     BUT: this method is heavily redefined for objects which
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7307
     can print prettier."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7308
6235
8eacf62c458e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6221
diff changeset
  7309
    self basicPrintOn:aStream.
8eacf62c458e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6221
diff changeset
  7310
8eacf62c458e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6221
diff changeset
  7311
   "
8eacf62c458e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6221
diff changeset
  7312
    (1@2) printOn:Transcript
8eacf62c458e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6221
diff changeset
  7313
    (1@2) basicPrintOn:Transcript
8eacf62c458e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6221
diff changeset
  7314
   "
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7315
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7316
11068
a5ef673886fd #printOn:format: and #printStringFormat for Date/Time compatibility
Stefan Vogel <sv@exept.de>
parents: 11065
diff changeset
  7317
printOn:aStream format:format
11335
c061d08b766f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11314
diff changeset
  7318
    "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
  7319
     Defined here for compatibility with subclasses"
a5ef673886fd #printOn:format: and #printStringFormat for Date/Time compatibility
Stefan Vogel <sv@exept.de>
parents: 11065
diff changeset
  7320
a5ef673886fd #printOn:format: and #printStringFormat for Date/Time compatibility
Stefan Vogel <sv@exept.de>
parents: 11065
diff changeset
  7321
    self printOn:aStream.
a5ef673886fd #printOn:format: and #printStringFormat for Date/Time compatibility
Stefan Vogel <sv@exept.de>
parents: 11065
diff changeset
  7322
!
a5ef673886fd #printOn:format: and #printStringFormat for Date/Time compatibility
Stefan Vogel <sv@exept.de>
parents: 11065
diff changeset
  7323
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7324
printOn:aStream leftPaddedTo:size
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7325
    "print the receiver on aStream, padding with spaces up to size.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7326
     padding is done on the left."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7327
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7328
    self printOn:aStream leftPaddedTo:size with:(Character space)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7329
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7330
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7331
     123 printOn:Transcript leftPaddedTo:10. Transcript cr
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7332
     123 printOn:Transcript leftPaddedTo:2. Transcript cr
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7333
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7334
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7335
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7336
printOn:aStream leftPaddedTo:size with:padCharacter
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7337
    "print the receiver on aStream, padding with padCharacters up to size.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7338
     padding is done on the left."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7339
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7340
    aStream nextPutAll:(self printStringLeftPaddedTo:size with:padCharacter)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7341
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7342
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7343
     123 printOn:Transcript leftPaddedTo:10 with:$_ . Transcript cr
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7344
     123 printOn:Transcript leftPaddedTo:10 with:$. . Transcript cr
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7345
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7346
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7347
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7348
printOn:aStream paddedTo:size
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7349
    "print the receiver on aStream, padding with spaces up to size."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7350
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7351
    self printOn:aStream paddedTo:size with:(Character space)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7352
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7353
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7354
     123.0 printOn:Transcript paddedTo:10. Transcript nextPut:$|. Transcript cr
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7355
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7356
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7357
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7358
printOn:aStream paddedTo:size with:padCharacter
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7359
    "print the receiver on aStream, padding with padCharacter up to size"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7360
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7361
    aStream nextPutAll:(self printStringPaddedTo:size with:padCharacter).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7362
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
     123 printOn:Transcript paddedTo:10 with:$_ . Transcript cr
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7365
     123 printOn:Transcript paddedTo:10 with:$. . Transcript cr
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7366
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7367
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7368
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7369
printOn:aStream zeroPaddedTo:size
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7370
    "print the receiver on aStream, padding with zeros up to size.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7371
     Usually used with float numbers."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7372
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7373
    self printOn:aStream paddedTo:size with:$0.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7374
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7375
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7376
     123.0 printOn:Transcript zeroPaddedTo:10
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7377
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7378
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7379
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7380
printRightAdjustLen:size
11068
a5ef673886fd #printOn:format: and #printStringFormat for Date/Time compatibility
Stefan Vogel <sv@exept.de>
parents: 11065
diff changeset
  7381
    <resource: #obsolete>
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7382
    "obsolete - just a name confusion.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7383
     This method will go away ..."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7384
19382
a471e303346c #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19340
diff changeset
  7385
    (self printStringLeftPaddedTo:size) print
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7386
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7387
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7388
printString
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7389
    "return a string for printing the receiver.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7390
     Since we now use printOn: as the basic print mechanism,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7391
     we have to create a stream and print into it."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7392
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7393
    |s|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7394
19340
2e2523f386df #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19287
diff changeset
  7395
    "allocate at least 40 bytes for fast UUID conversion.
2e2523f386df #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19287
diff changeset
  7396
     cg: who did that? If that's a bottleneck, it ought to be done in UUID, not here!!"
2e2523f386df #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19287
diff changeset
  7397
2e2523f386df #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19287
diff changeset
  7398
    s := CharacterWriteStream on:(String basicNew:40).     
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7399
    self printOn:s.
8300
d15ead94361f Use CharacterWriteStream in #printString (speedup)
Stefan Vogel <sv@exept.de>
parents: 8287
diff changeset
  7400
    ^ s contents.
7978
4ce7575e1cfc care for 16bit chars in #printString
Claus Gittinger <cg@exept.de>
parents: 7838
diff changeset
  7401
4ce7575e1cfc care for 16bit chars in #printString
Claus Gittinger <cg@exept.de>
parents: 7838
diff changeset
  7402
    "
4ce7575e1cfc care for 16bit chars in #printString
Claus Gittinger <cg@exept.de>
parents: 7838
diff changeset
  7403
     Date today printString.
4ce7575e1cfc care for 16bit chars in #printString
Claus Gittinger <cg@exept.de>
parents: 7838
diff changeset
  7404
    "
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7405
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7406
11068
a5ef673886fd #printOn:format: and #printStringFormat for Date/Time compatibility
Stefan Vogel <sv@exept.de>
parents: 11065
diff changeset
  7407
printStringFormat:orintFormat
a5ef673886fd #printOn:format: and #printStringFormat for Date/Time compatibility
Stefan Vogel <sv@exept.de>
parents: 11065
diff changeset
  7408
    "subclasses may redefine this.
a5ef673886fd #printOn:format: and #printStringFormat for Date/Time compatibility
Stefan Vogel <sv@exept.de>
parents: 11065
diff changeset
  7409
     Defined here to avoid type checks"
a5ef673886fd #printOn:format: and #printStringFormat for Date/Time compatibility
Stefan Vogel <sv@exept.de>
parents: 11065
diff changeset
  7410
a5ef673886fd #printOn:format: and #printStringFormat for Date/Time compatibility
Stefan Vogel <sv@exept.de>
parents: 11065
diff changeset
  7411
    ^ self printString
a5ef673886fd #printOn:format: and #printStringFormat for Date/Time compatibility
Stefan Vogel <sv@exept.de>
parents: 11065
diff changeset
  7412
!
a5ef673886fd #printOn:format: and #printStringFormat for Date/Time compatibility
Stefan Vogel <sv@exept.de>
parents: 11065
diff changeset
  7413
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7414
printStringLeftPaddedTo:size
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7415
    "return my printString as a right-adjusted string of length size;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7416
     characters on the left are filled with spaces.
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  7417
     If the printString is longer than size,
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7418
     it is returned unchanged (i.e. not truncated)"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7419
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7420
    ^ self printStringLeftPaddedTo:size with:(Character space)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7421
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
     10 printStringLeftPaddedTo:10
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7424
     1 printStringLeftPaddedTo:10
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7425
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7426
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7427
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7428
printStringLeftPaddedTo:size ifLarger:alternative
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7429
    "return my printString as a right-adjusted string of length size;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7430
     characters on the left are filled with spaces.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7431
     If the printString is larger than size,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7432
     return the result from evaluating alternative."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7433
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7434
    ^ self printStringLeftPaddedTo:size with:(Character space) ifLarger:alternative
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7435
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7436
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7437
     12   printStringLeftPaddedTo:3 ifLarger:['***']
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7438
     123  printStringLeftPaddedTo:3 ifLarger:['***']
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7439
     1234 printStringLeftPaddedTo:3 ifLarger:['***']
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7440
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7441
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7442
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7443
printStringLeftPaddedTo:size with:padCharacter
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7444
    "return my printString as a right-adjusted string of length size;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7445
     characters on the left are filled with padCharacter.
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  7446
     If the printString is longer than size,
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7447
     it is returned unchanged (i.e. not truncated)"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7448
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7449
    ^ (self printString) leftPaddedTo:size with:padCharacter
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7450
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7451
    "
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  7452
     123 printStringLeftPaddedTo:10 with:$.
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  7453
     1 printStringLeftPaddedTo:10 with:$.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7454
     (Float pi) printStringLeftPaddedTo:20 with:$*
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7455
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7456
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7457
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7458
printStringLeftPaddedTo:size with:padCharacter ifLarger:alternative
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7459
    "return my printString as a right-adjusted string of length size;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7460
     characters on the left are filled with padCharacter.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7461
     If the printString is larger than size,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7462
     return the result from evaluating alternative."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7463
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7464
    |s|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7465
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7466
    s := self printString.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7467
    s size > size ifTrue:[^ alternative value].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7468
    ^ s leftPaddedTo:size with:padCharacter
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7469
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7470
    "
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  7471
     12   printStringLeftPaddedTo:3 with:$. ifLarger:['***']
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  7472
     123  printStringLeftPaddedTo:3 with:$. ifLarger:['***']
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  7473
     1234 printStringLeftPaddedTo:3 with:$. ifLarger:['***']
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7474
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7475
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7476
8576
f58f51583a34 +printStringLimitedTo:
Claus Gittinger <cg@exept.de>
parents: 8574
diff changeset
  7477
printStringLimitedTo:sizeLimit
f58f51583a34 +printStringLimitedTo:
Claus Gittinger <cg@exept.de>
parents: 8574
diff changeset
  7478
    "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
  7479
f58f51583a34 +printStringLimitedTo:
Claus Gittinger <cg@exept.de>
parents: 8574
diff changeset
  7480
    |s|
f58f51583a34 +printStringLimitedTo:
Claus Gittinger <cg@exept.de>
parents: 8574
diff changeset
  7481
f58f51583a34 +printStringLimitedTo:
Claus Gittinger <cg@exept.de>
parents: 8574
diff changeset
  7482
    s := CharacterWriteStream on:(String basicNew:30).
f58f51583a34 +printStringLimitedTo:
Claus Gittinger <cg@exept.de>
parents: 8574
diff changeset
  7483
    s writeLimit:sizeLimit.
f58f51583a34 +printStringLimitedTo:
Claus Gittinger <cg@exept.de>
parents: 8574
diff changeset
  7484
    self printOn:s.
f58f51583a34 +printStringLimitedTo:
Claus Gittinger <cg@exept.de>
parents: 8574
diff changeset
  7485
    ^ s contents.
f58f51583a34 +printStringLimitedTo:
Claus Gittinger <cg@exept.de>
parents: 8574
diff changeset
  7486
f58f51583a34 +printStringLimitedTo:
Claus Gittinger <cg@exept.de>
parents: 8574
diff changeset
  7487
    "
f58f51583a34 +printStringLimitedTo:
Claus Gittinger <cg@exept.de>
parents: 8574
diff changeset
  7488
     Date today printStringLimitedTo:5.
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  7489
     '12345678901234567890' printStringLimitedTo:5.
8576
f58f51583a34 +printStringLimitedTo:
Claus Gittinger <cg@exept.de>
parents: 8574
diff changeset
  7490
    "
f58f51583a34 +printStringLimitedTo:
Claus Gittinger <cg@exept.de>
parents: 8574
diff changeset
  7491
!
f58f51583a34 +printStringLimitedTo:
Claus Gittinger <cg@exept.de>
parents: 8574
diff changeset
  7492
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7493
printStringOnError:exceptionBlock
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7494
    "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
  7495
     evaluating exceptionBlock. Useful to print something in an exceptionHandler or other
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7496
     cleanup code."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7497
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7498
    |rslt|
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
    Error handle:[:ex |
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  7501
        rslt := exceptionBlock value
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7502
    ] do:[
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  7503
        rslt := self printString
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7504
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7505
    ^ rslt
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7506
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7507
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7508
printStringPaddedTo:size
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7509
    "return a printed representation of the receiver,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7510
     padded with spaces (at the right) up to size.
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  7511
     If the printString is longer than size,
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7512
     it is returned unchanged (i.e. not truncated)"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7513
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7514
    ^ self printStringPaddedTo:size with:(Character space)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7515
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7516
    "
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  7517
     123 printStringPaddedTo:10
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  7518
     1234567890123456 printStringPaddedTo:10
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  7519
     'hello' printStringPaddedTo:10
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7520
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7521
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7522
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7523
printStringPaddedTo:size ifLarger:alternative
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7524
    "return a printed representation of the receiver,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7525
     padded with spaces (at the right) up to size.
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  7526
     If the resulting printString is too large,
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7527
     return the result from evaluating alternative."
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
    ^ self printStringPaddedTo:size with:(Character space) ifLarger:alternative
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
    "
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  7532
     12   printStringPaddedTo:3 ifLarger:['***']
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  7533
     123  printStringPaddedTo:3 ifLarger:['***']
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  7534
     1234 printStringPaddedTo:3 ifLarger:['***']
5755
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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7538
printStringPaddedTo:size with:padCharacter
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7539
    "return a printed representation of the receiver,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7540
     padded with padCharacter (at the right) up to size.
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  7541
     If the printString is longer than size,
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7542
     it is returned unchanged (i.e. not truncated)"
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
    ^ (self printString) paddedTo:size with:padCharacter
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7545
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7546
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7547
     123  printStringPaddedTo:10 with:$.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7548
     123  printStringPaddedTo:10 with:$*
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  7549
     123  printStringPaddedTo:3 with:$*
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  7550
     1234 printStringPaddedTo:3 with:$*
5755
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
!
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
printStringPaddedTo:size with:padCharacter ifLarger:alternative
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7555
    "return a printed representation of the receiver,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7556
     padded with padCharacter (at the right) up to size.
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  7557
     If the resulting printString is too large,
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7558
     return the result from evaluating alternative."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7559
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7560
    |s|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7561
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7562
    s := self printString.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7563
    s size > size ifTrue:[^ alternative value].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7564
    ^ s paddedTo:size with:padCharacter
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7565
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7566
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7567
     123   printStringPaddedTo:3 with:$. ifLarger:['***']
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7568
     12345 printStringPaddedTo:3 with:$. ifLarger:['***']
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7569
    "
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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7572
printStringRightAdjustLen:size
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7573
    "obsolete - just a name confusion.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7574
     This method will go away ..."
11068
a5ef673886fd #printOn:format: and #printStringFormat for Date/Time compatibility
Stefan Vogel <sv@exept.de>
parents: 11065
diff changeset
  7575
    <resource: #obsolete>
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7576
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7577
    ^ self printStringLeftPaddedTo:size
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7578
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7579
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7580
printStringZeroPaddedTo:size
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  7581
    "return a printed representation of the receiver,
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7582
     padded with zero (at the right) characters up to size.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7583
     Usually used with float numbers."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7584
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7585
    ^ self printStringPaddedTo:size with:$0
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7586
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7587
    "
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  7588
     123.0 printStringZeroPaddedTo:10
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7589
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7590
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7591
8287
9770f4ad54ff +printfPrintString
werner
parents: 8273
diff changeset
  7592
printfPrintString:ignoredFormat
9770f4ad54ff +printfPrintString
werner
parents: 8273
diff changeset
  7593
    "fallback to default printString
9770f4ad54ff +printfPrintString
werner
parents: 8273
diff changeset
  7594
     (for compatibility with float and integer-printing)"
9770f4ad54ff +printfPrintString
werner
parents: 8273
diff changeset
  7595
9770f4ad54ff +printfPrintString
werner
parents: 8273
diff changeset
  7596
    ^ self printString
9770f4ad54ff +printfPrintString
werner
parents: 8273
diff changeset
  7597
!
9770f4ad54ff +printfPrintString
werner
parents: 8273
diff changeset
  7598
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7599
store
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7600
    "store the receiver on standard output.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7601
     this method is useless, but included for compatibility."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7602
19382
a471e303346c #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19340
diff changeset
  7603
    self storeOn:Processor activeProcess stdout
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7604
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7605
7600
5a3fee21c032 #storeString - omit # from Symbols and Arrays that are elements of an array.
Stefan Vogel <sv@exept.de>
parents: 7576
diff changeset
  7606
storeArrayElementOn:aStream
5a3fee21c032 #storeString - omit # from Symbols and Arrays that are elements of an array.
Stefan Vogel <sv@exept.de>
parents: 7576
diff changeset
  7607
    "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
  7608
     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
  7609
5a3fee21c032 #storeString - omit # from Symbols and Arrays that are elements of an array.
Stefan Vogel <sv@exept.de>
parents: 7576
diff changeset
  7610
    ^ 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
  7611
!
5a3fee21c032 #storeString - omit # from Symbols and Arrays that are elements of an array.
Stefan Vogel <sv@exept.de>
parents: 7576
diff changeset
  7612
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7613
storeCR
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7614
    "store the receiver on standard output; append a carriage return."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7615
19382
a471e303346c #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19340
diff changeset
  7616
    |stdout|
a471e303346c #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19340
diff changeset
  7617
    
a471e303346c #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19340
diff changeset
  7618
    stdout := Processor activeProcess stdout.
a471e303346c #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19340
diff changeset
  7619
    self storeOn:stdout.
a471e303346c #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19340
diff changeset
  7620
    stdout cr.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7621
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7622
    "Created: 20.5.1996 / 10:26:01 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7623
    "Modified: 20.5.1996 / 10:26:57 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7624
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7625
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7626
storeNl
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7627
    "store the receiver on standard output; append a newline.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7628
     This method is included for backward compatibility-  use #storeCR."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7629
5893
f92054b38d3c Assign #obsolete resource to obsolete methods
Stefan Vogel <sv@exept.de>
parents: 5879
diff changeset
  7630
    <resource:#obsolete>
f92054b38d3c Assign #obsolete resource to obsolete methods
Stefan Vogel <sv@exept.de>
parents: 5879
diff changeset
  7631
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7632
    self storeCR.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7633
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7634
    "Modified: 20.5.1996 / 10:26:49 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7635
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7636
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7637
storeOn:aStream
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7638
    "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
  7639
     reconstruct the receiver.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7640
     Notice, that no self referencing or cyclic objects can be represented
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7641
     in this format.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7642
     Use storeBinaryOn:, which handles these cases correctly."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7643
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7644
    |myClass hasSemi sz "{ Class: SmallInteger }" |
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7645
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7646
    thisContext isRecursive ifTrue:[
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  7647
        RecursiveStoreError raiseRequestWith:self.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  7648
        'Object [error]: storeString of self referencing object (' errorPrint.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  7649
        self class name errorPrint.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  7650
        ')' errorPrintCR.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  7651
        aStream nextPutAll:'#("recursive")'.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  7652
        ^ self
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7653
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7654
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7655
    myClass := self class.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7656
    aStream nextPut:$(.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7657
    aStream nextPutAll:self class name.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7658
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7659
    hasSemi := false.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7660
    myClass isVariable ifTrue:[
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  7661
        aStream nextPutAll:' basicNew:'.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  7662
        self basicSize printOn:aStream
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7663
    ] ifFalse:[
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  7664
        aStream nextPutAll:' basicNew'
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7665
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7666
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7667
    sz := myClass instSize.
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  7668
    1 to:sz do:[:i |
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  7669
        |ref|
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  7670
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  7671
        ref := (self instVarAt:i).
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  7672
        "/ no need to store nil entries, because the object has been instantiated
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  7673
        "/ with basicNew just a moment ago (so the fields are already nil)
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  7674
        ref notNil ifTrue:[
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  7675
            aStream nextPutAll:' instVarAt:'.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  7676
            i printOn:aStream.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  7677
            aStream nextPutAll:' put:'.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  7678
            ref storeOn:aStream.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  7679
            aStream nextPut:$;.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  7680
            hasSemi := true
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  7681
        ].
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7682
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7683
    myClass isVariable ifTrue:[
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  7684
        sz := self basicSize.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  7685
        1 to:sz do:[:i |
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  7686
            |ref|
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  7687
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  7688
            ref := (self basicAt:i).
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  7689
            "/ no need to store nil entries, because the object has been instantiated
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  7690
            "/ with basicNew just a moment ago (so the fields are already nil)
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  7691
            ref notNil ifTrue:[
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  7692
                aStream nextPutAll:' basicAt:'.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  7693
                i printOn:aStream.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  7694
                aStream nextPutAll:' put:'.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  7695
                ref storeOn:aStream.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  7696
                aStream nextPut:$;.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  7697
                hasSemi := true
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  7698
            ]
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  7699
        ]
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7700
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7701
    hasSemi ifTrue:[
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  7702
        aStream nextPutAll:' yourself'
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7703
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7704
    aStream nextPut:$).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7705
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7706
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7707
     |s|
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
     s := WriteStream on:(String new).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7710
     ('hello' -> 'world') storeOn:s.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7711
     s := ReadStream on:(s contents).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7712
     (Object readFrom:s) inspect
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
     |s|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7716
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7717
     s := 'data' asFilename writeStream.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7718
     ('hello' -> 'world') storeOn:s.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7719
     s close.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7720
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7721
     s := 'data' asFilename readStream.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7722
     (Object readFrom:s) inspect
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7723
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7724
16590
c6a17a505282 class: Object
Claus Gittinger <cg@exept.de>
parents: 16588
diff changeset
  7725
    "does not work example (cyclic):"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7726
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7727
     |s a|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7728
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7729
     a := Array new:2.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7730
     a at:1 put:a.
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
     s := 'data' asFilename writeStream.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7733
     a storeOn:s.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7734
     s close.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7735
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7736
     s := 'data' asFilename readStream.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7737
     (Object readFrom:s) inspect
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7738
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7739
13162
dd688290df14 changed: #storeOn:
Claus Gittinger <cg@exept.de>
parents: 13140
diff changeset
  7740
    "Modified: / 03-12-2010 / 13:27:51 / cg"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7741
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7742
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7743
storeString
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7744
    "return a string representing an expression to reconstruct the receiver.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7745
     Notice, that no self referencing or cyclic objects can be represented
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7746
     in this format.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7747
     Use storeBinaryOn:, which handles these cases correctly."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7748
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7749
    |s|
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
    s := WriteStream on:(String new:50).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7752
    self storeOn:s.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7753
    ^ s contents
13350
8c7603161369 added: #withErrorStreamDo:
Claus Gittinger <cg@exept.de>
parents: 13320
diff changeset
  7754
!
8c7603161369 added: #withErrorStreamDo:
Claus Gittinger <cg@exept.de>
parents: 13320
diff changeset
  7755
8c7603161369 added: #withErrorStreamDo:
Claus Gittinger <cg@exept.de>
parents: 13320
diff changeset
  7756
withErrorStreamDo:aBlock
8c7603161369 added: #withErrorStreamDo:
Claus Gittinger <cg@exept.de>
parents: 13320
diff changeset
  7757
    "{ Pragma: +optSpace }"
8c7603161369 added: #withErrorStreamDo:
Claus Gittinger <cg@exept.de>
parents: 13320
diff changeset
  7758
16560
Claus Gittinger <cg@exept.de>
parents: 16470
diff changeset
  7759
    "helper for error messages - evaluate aBlock,
19784
4b81dcd2d740 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19781
diff changeset
  7760
     passing it a stream on which to put error messages.
4b81dcd2d740 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19781
diff changeset
  7761
     Notice that the block might be called twice,
4b81dcd2d740 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19781
diff changeset
  7762
     to print both on stderr and onto the Transcript"
13350
8c7603161369 added: #withErrorStreamDo:
Claus Gittinger <cg@exept.de>
parents: 13320
diff changeset
  7763
19428
117f7e571ea0 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19382
diff changeset
  7764
    |stream stderr activeProcess|
117f7e571ea0 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19382
diff changeset
  7765
117f7e571ea0 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19382
diff changeset
  7766
    activeProcess := Processor activeProcess.
117f7e571ea0 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19382
diff changeset
  7767
    stderr := activeProcess stderr.
19382
a471e303346c #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19340
diff changeset
  7768
    
16383
4cb54426f3c0 class: Object
Claus Gittinger <cg@exept.de>
parents: 16378
diff changeset
  7769
    "CG: care for standalone non-GUI progs, which have no userPreferences class"
4cb54426f3c0 class: Object
Claus Gittinger <cg@exept.de>
parents: 16378
diff changeset
  7770
    (Smalltalk isInitialized
4cb54426f3c0 class: Object
Claus Gittinger <cg@exept.de>
parents: 16378
diff changeset
  7771
    and:[ UserPreferences notNil
4cb54426f3c0 class: Object
Claus Gittinger <cg@exept.de>
parents: 16378
diff changeset
  7772
    and:[ UserPreferences current sendMessagesAlsoToTranscript]]) ifTrue:[
19428
117f7e571ea0 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19382
diff changeset
  7773
        stream := activeProcess isSystemProcess
19784
4b81dcd2d740 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19781
diff changeset
  7774
                            ifTrue:[stderr]
4b81dcd2d740 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19781
diff changeset
  7775
                            ifFalse:[activeProcess transcript].
16378
d88d0cc60491 class: Object
Claus Gittinger <cg@exept.de>
parents: 16349
diff changeset
  7776
    ].
d88d0cc60491 class: Object
Claus Gittinger <cg@exept.de>
parents: 16349
diff changeset
  7777
    stream notNil ifTrue:[
19382
a471e303346c #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19340
diff changeset
  7778
        StreamError catch:[
a471e303346c #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19340
diff changeset
  7779
            aBlock value:stream.
a471e303346c #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19340
diff changeset
  7780
        ].
a471e303346c #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19340
diff changeset
  7781
    ].
a471e303346c #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19340
diff changeset
  7782
    stream ~~ stderr ifTrue:[
19784
4b81dcd2d740 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19781
diff changeset
  7783
        UserPreferences current sendMessagesOnlyToTranscript ifFalse:[
4b81dcd2d740 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19781
diff changeset
  7784
            aBlock value:stderr.
4b81dcd2d740 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19781
diff changeset
  7785
        ].
13350
8c7603161369 added: #withErrorStreamDo:
Claus Gittinger <cg@exept.de>
parents: 13320
diff changeset
  7786
    ].
8c7603161369 added: #withErrorStreamDo:
Claus Gittinger <cg@exept.de>
parents: 13320
diff changeset
  7787
8c7603161369 added: #withErrorStreamDo:
Claus Gittinger <cg@exept.de>
parents: 13320
diff changeset
  7788
    "Created: / 21-04-2011 / 12:46:21 / cg"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7789
! !
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
!Object methodsFor:'queries'!
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
basicSize
19451
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  7794
    "return the number of the receiver's indexed instance variables,
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7795
     0 if it has none.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7796
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7797
     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
  7798
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7799
%{  /* NOCONTEXT */
18240
28af09029a8b ifdef for SCHTEAM engine changed (not relevant for ST/X)
Claus Gittinger <cg@exept.de>
parents: 18238
diff changeset
  7800
#ifdef __SCHTEAM__
18404
ae9230dde5ca comments
Claus Gittinger <cg@exept.de>
parents: 18371
diff changeset
  7801
    return context._RETURN( STInteger._new( self.basicSize() ) );
18215
5940d5eff81b java preps
Claus Gittinger <cg@exept.de>
parents: 18185
diff changeset
  7802
#else
8909
485a8e3153e0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  7803
    REGISTER INT nbytes;
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7804
    REGISTER OBJ myClass;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7805
    int nInstBytes;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7806
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7807
    /*
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7808
     * notice the missing test for self being a nonNilObject -
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7809
     * this can be done since basicSize is defined both in UndefinedObject
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7810
     * and SmallInteger
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7811
     */
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7812
    myClass = __qClass(self);
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7813
    nbytes = __qSize(self);
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7814
    nInstBytes = OHDR_SIZE + __OBJS2BYTES__( __intVal(__ClassInstPtr(myClass)->c_ninstvars) );
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7815
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7816
    switch ((INT)(__ClassInstPtr(myClass)->c_flags) & __MASKSMALLINT(ARRAYMASK)) {
19451
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  7817
        case __MASKSMALLINT(POINTERARRAY):
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  7818
        case __MASKSMALLINT(WKPOINTERARRAY):
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  7819
            nbytes -= nInstBytes;
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  7820
            RETURN ( __mkSmallInteger(__BYTES2OBJS__(nbytes)) );
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  7821
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  7822
        case __MASKSMALLINT(BYTEARRAY):
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  7823
            nbytes -= nInstBytes;
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  7824
            RETURN ( __mkSmallInteger(nbytes / sizeof(char)) );
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  7825
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  7826
        case __MASKSMALLINT(FLOATARRAY):
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  7827
            nbytes -= nInstBytes;
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  7828
            RETURN ( __mkSmallInteger(nbytes / sizeof(float)) );
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  7829
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  7830
        case __MASKSMALLINT(DOUBLEARRAY):
18215
5940d5eff81b java preps
Claus Gittinger <cg@exept.de>
parents: 18185
diff changeset
  7831
# ifdef __NEED_DOUBLE_ALIGN
19451
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  7832
            nInstBytes = (nInstBytes-1+__DOUBLE_ALIGN) &~ (__DOUBLE_ALIGN-1);
18215
5940d5eff81b java preps
Claus Gittinger <cg@exept.de>
parents: 18185
diff changeset
  7833
# endif
19451
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  7834
            nbytes -= nInstBytes;
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  7835
            RETURN ( __mkSmallInteger(nbytes / sizeof(double)) );
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  7836
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  7837
        case __MASKSMALLINT(WORDARRAY):
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  7838
        case __MASKSMALLINT(SWORDARRAY):
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  7839
            nbytes -= nInstBytes;
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  7840
            RETURN ( __mkSmallInteger(nbytes>>1) ); /* notice the hardcoded 2 here - not sizeof(short) */
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  7841
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  7842
        case __MASKSMALLINT(LONGARRAY):
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  7843
        case __MASKSMALLINT(SLONGARRAY):
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  7844
            nbytes -= nInstBytes;
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  7845
            RETURN ( __mkSmallInteger(nbytes>>2) ); /* notice the hardcoded 4 here - not sizeof(int) */
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  7846
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  7847
        case __MASKSMALLINT(LONGLONGARRAY):
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  7848
        case __MASKSMALLINT(SLONGLONGARRAY):
18215
5940d5eff81b java preps
Claus Gittinger <cg@exept.de>
parents: 18185
diff changeset
  7849
# ifdef __NEED_LONGLONG_ALIGN
19451
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  7850
            nInstBytes = (nInstBytes-1+__LONGLONG_ALIGN) &~ (__LONGLONG_ALIGN-1);
18215
5940d5eff81b java preps
Claus Gittinger <cg@exept.de>
parents: 18185
diff changeset
  7851
# endif
19451
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  7852
            nbytes -= nInstBytes;
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  7853
            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
  7854
    }
18240
28af09029a8b ifdef for SCHTEAM engine changed (not relevant for ST/X)
Claus Gittinger <cg@exept.de>
parents: 18238
diff changeset
  7855
#endif /* not __SCHTEAM__ */
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7856
%}.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7857
    ^ 0
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7858
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7859
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7860
byteSize
19451
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  7861
    "return the number of bytes in the receiver's indexed instance variables,
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7862
     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
  7863
     instvars i.e. byteArrays, wordArrays etc.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7864
     Notice: for Strings the returned size may look strange.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7865
     Only useful with binary storage."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7866
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7867
    |myClass|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7868
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7869
    myClass := self class.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7870
    myClass isVariable ifTrue:[
19451
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  7871
        myClass isPointers ifFalse:[
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  7872
            myClass isBytes ifTrue:[
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  7873
                ^ self basicSize.
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  7874
            ].
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  7875
            myClass isWords ifTrue:[
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  7876
                ^ self basicSize * 2.
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  7877
            ].
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  7878
            myClass isSignedWords ifTrue:[
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  7879
                ^ self basicSize * 2.
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  7880
            ].
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  7881
            myClass isLongs ifTrue:[
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  7882
                ^ self basicSize * 4.
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  7883
            ].
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  7884
            myClass isSignedLongs ifTrue:[
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  7885
                ^ self basicSize * 4.
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  7886
            ].
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  7887
            myClass isLongLongs ifTrue:[
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  7888
                ^ self basicSize * 8.
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  7889
            ].
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  7890
            myClass isSignedLongLongs ifTrue:[
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  7891
                ^ self basicSize * 8.
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  7892
            ].
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  7893
            myClass isFloats ifTrue:[
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  7894
                ^ self basicSize * (ExternalBytes sizeofFloat)
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  7895
            ].
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  7896
            myClass isDoubles ifTrue:[
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  7897
                ^ self basicSize * (ExternalBytes sizeofDouble)
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  7898
            ].
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  7899
            self error:'unknown variable size class species'.
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  7900
        ]
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7901
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7902
    ^ 0
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7903
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7904
    "
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  7905
     Point new byteSize
14632
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14539
diff changeset
  7906
     'hello' byteSize
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14539
diff changeset
  7907
     'hello' asUnicode16String byteSize
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  7908
     (ByteArray with:1 with:2) byteSize
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  7909
     (FloatArray with:1.5) byteSize
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  7910
     (DoubleArray with:1.5) byteSize
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  7911
     (WordArray with:1 with:2) byteSize
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7912
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7913
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7914
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7915
class
19679
c5eec12206f6 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 19646
diff changeset
  7916
    "return the receiver's class"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7917
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7918
%{  /* NOCONTEXT */
18240
28af09029a8b ifdef for SCHTEAM engine changed (not relevant for ST/X)
Claus Gittinger <cg@exept.de>
parents: 18238
diff changeset
  7919
#ifdef __SCHTEAM__
18215
5940d5eff81b java preps
Claus Gittinger <cg@exept.de>
parents: 18185
diff changeset
  7920
    return context._RETURN(self.clazz());
5940d5eff81b java preps
Claus Gittinger <cg@exept.de>
parents: 18185
diff changeset
  7921
#else
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7922
    RETURN ( __Class(self) );
18215
5940d5eff81b java preps
Claus Gittinger <cg@exept.de>
parents: 18185
diff changeset
  7923
#endif
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7924
%}
19679
c5eec12206f6 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 19646
diff changeset
  7925
c5eec12206f6 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 19646
diff changeset
  7926
    "Modified (comment): / 30-04-2016 / 15:51:17 / cg"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7927
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7928
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7929
respondsTo:aSelector
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7930
    "return true, if the receiver implements a method with selector equal
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7931
     to aSelector; i.e. if there is a method for aSelector in either the
19451
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  7932
     receiver's class or one of its superclasses.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7933
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7934
     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
  7935
     an error being raised. For example, an implementation could send
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7936
     #shouldNotImplement or #subclassResponsibility."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7937
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7938
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7939
     should we go via the cache, or search (by class) ?
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7940
     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
  7941
     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
  7942
     For now, use the cache ...
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7943
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7944
%{  /* NOCONTEXT */
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7945
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7946
    if (__lookup(__Class(self), aSelector) == nil) {
19451
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  7947
        RETURN ( false );
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7948
    }
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7949
    RETURN ( true );
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7950
%}
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7951
.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7952
    ^ self class canUnderstand:aSelector
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7953
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7954
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7955
    "'aString' respondsTo:#+"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7956
    "'aString' respondsTo:#,"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7957
    "'aString' respondsTo:#collect:"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7958
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7959
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7960
respondsToArithmetic
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7961
    "return true, if the receiver responds to arithmetic messages.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7962
     false is returned here - the method is redefined in ArithmeticValue."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7963
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7964
    ^ false
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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7967
size
19451
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  7968
    "return the number of the receiver's indexed instance variables;
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7969
     this method may be redefined in subclasses"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7970
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7971
    ^ self basicSize
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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7974
species
19451
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  7975
    "return a class which is similar to (or the same as) the receiver's class.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7976
     This is used to create an appropriate object when creating derived
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7977
     copies in the collection classes (sometimes redefined)."
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
    ^ self class
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7980
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7981
16401
ae4c51e826cb class: Object
Claus Gittinger <cg@exept.de>
parents: 16383
diff changeset
  7982
speciesForCopy
ae4c51e826cb class: Object
Claus Gittinger <cg@exept.de>
parents: 16383
diff changeset
  7983
    "return a class which is the receiver's class, except for readonly objects,
ae4c51e826cb class: Object
Claus Gittinger <cg@exept.de>
parents: 16383
diff changeset
  7984
     such as immutable collections.
ae4c51e826cb class: Object
Claus Gittinger <cg@exept.de>
parents: 16383
diff changeset
  7985
     This is only to be used by copy methods"
ae4c51e826cb class: Object
Claus Gittinger <cg@exept.de>
parents: 16383
diff changeset
  7986
ae4c51e826cb class: Object
Claus Gittinger <cg@exept.de>
parents: 16383
diff changeset
  7987
    ^ self class
ae4c51e826cb class: Object
Claus Gittinger <cg@exept.de>
parents: 16383
diff changeset
  7988
!
ae4c51e826cb class: Object
Claus Gittinger <cg@exept.de>
parents: 16383
diff changeset
  7989
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7990
yourself
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7991
    "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
  7992
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7993
    ^ self
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7994
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7995
20027
5be764ee44fb #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 19846
diff changeset
  7996
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7997
!Object methodsFor:'secure message sending'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7998
18215
5940d5eff81b java preps
Claus Gittinger <cg@exept.de>
parents: 18185
diff changeset
  7999
?:selector
13099
fdcece3bda6c added: #?:
Claus Gittinger <cg@exept.de>
parents: 13039
diff changeset
  8000
    "try to send a message to the receiver;
fdcece3bda6c added: #?:
Claus Gittinger <cg@exept.de>
parents: 13039
diff changeset
  8001
     if understood, return the value;
fdcece3bda6c added: #?:
Claus Gittinger <cg@exept.de>
parents: 13039
diff changeset
  8002
     if not, return nil."
18215
5940d5eff81b java preps
Claus Gittinger <cg@exept.de>
parents: 18185
diff changeset
  8003
13099
fdcece3bda6c added: #?:
Claus Gittinger <cg@exept.de>
parents: 13039
diff changeset
  8004
    ^ self perform:selector ifNotUnderstood:nil
fdcece3bda6c added: #?:
Claus Gittinger <cg@exept.de>
parents: 13039
diff changeset
  8005
fdcece3bda6c added: #?:
Claus Gittinger <cg@exept.de>
parents: 13039
diff changeset
  8006
    "
fdcece3bda6c added: #?:
Claus Gittinger <cg@exept.de>
parents: 13039
diff changeset
  8007
     ApplicationModel new masterApplication resources first             - error
fdcece3bda6c added: #?:
Claus Gittinger <cg@exept.de>
parents: 13039
diff changeset
  8008
     ApplicationModel new ?: #masterApplication ?: #resources ?: #first - nil
fdcece3bda6c added: #?:
Claus Gittinger <cg@exept.de>
parents: 13039
diff changeset
  8009
    "
fdcece3bda6c added: #?:
Claus Gittinger <cg@exept.de>
parents: 13039
diff changeset
  8010
    "Modified: / 20-10-2010 / 10:45:21 / cg"
fdcece3bda6c added: #?:
Claus Gittinger <cg@exept.de>
parents: 13039
diff changeset
  8011
!
fdcece3bda6c added: #?:
Claus Gittinger <cg@exept.de>
parents: 13039
diff changeset
  8012
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8013
askFor:aSelector
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8014
    "try to send the receiver the message, aSelector.
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  8015
     If it does not understand it, return false.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8016
     Otherwise the real value returned.
11398
1f006dd241a7 +askFor:with:
Claus Gittinger <cg@exept.de>
parents: 11366
diff changeset
  8017
     Useful to send messages such as: #isColor to unknown receivers."
5755
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
    ^ self perform:aSelector ifNotUnderstood:[false]
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
    "
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  8022
     1 askFor:#isColor
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  8023
     Color red askFor:#isColor
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  8024
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  8025
     1 askFor:#isFoo
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  8026
     Color red askFor:#isFoo
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8027
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8028
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8029
11398
1f006dd241a7 +askFor:with:
Claus Gittinger <cg@exept.de>
parents: 11366
diff changeset
  8030
askFor:aSelector with:argument
1f006dd241a7 +askFor:with:
Claus Gittinger <cg@exept.de>
parents: 11366
diff changeset
  8031
    "try to send the receiver the message, aSelector.
1f006dd241a7 +askFor:with:
Claus Gittinger <cg@exept.de>
parents: 11366
diff changeset
  8032
     If it does not understand it, return false.
1f006dd241a7 +askFor:with:
Claus Gittinger <cg@exept.de>
parents: 11366
diff changeset
  8033
     Otherwise the real value returned.
1f006dd241a7 +askFor:with:
Claus Gittinger <cg@exept.de>
parents: 11366
diff changeset
  8034
     Useful to send messages such as: #isXXX: to unknown receivers."
1f006dd241a7 +askFor:with:
Claus Gittinger <cg@exept.de>
parents: 11366
diff changeset
  8035
1f006dd241a7 +askFor:with:
Claus Gittinger <cg@exept.de>
parents: 11366
diff changeset
  8036
    ^ self perform:aSelector with:argument ifNotUnderstood:[false]
1f006dd241a7 +askFor:with:
Claus Gittinger <cg@exept.de>
parents: 11366
diff changeset
  8037
!
1f006dd241a7 +askFor:with:
Claus Gittinger <cg@exept.de>
parents: 11366
diff changeset
  8038
11401
78104cb2fba3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11398
diff changeset
  8039
askFor:aSelector with:arg1 with:arg2
78104cb2fba3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11398
diff changeset
  8040
    "try to send the receiver the message, aSelector.
78104cb2fba3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11398
diff changeset
  8041
     If it does not understand it, return false.
78104cb2fba3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11398
diff changeset
  8042
     Otherwise the real value returned.
78104cb2fba3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11398
diff changeset
  8043
     Useful to send messages such as: #isXXX: to unknown receivers."
78104cb2fba3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11398
diff changeset
  8044
78104cb2fba3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11398
diff changeset
  8045
    ^ self perform:aSelector with:arg1 with:arg2 ifNotUnderstood:[false]
78104cb2fba3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11398
diff changeset
  8046
!
78104cb2fba3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11398
diff changeset
  8047
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8048
perform:aSelector ifNotUnderstood:exceptionBlock
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8049
    "try to send message aSelector to the receiver.
12157
114823c8f3b0 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 12050
diff changeset
  8050
     If its understood, return the method's returned value,
114823c8f3b0 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 12050
diff changeset
  8051
     otherwise return the value of the exceptionBlock.
114823c8f3b0 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 12050
diff changeset
  8052
     Read this:
114823c8f3b0 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 12050
diff changeset
  8053
     Many programmers do an Error-handle to perform a similar
114823c8f3b0 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 12050
diff changeset
  8054
     checked-message send. However, this method is more specific,
16560
Claus Gittinger <cg@exept.de>
parents: 16470
diff changeset
  8055
     in that only errors for the given selector are caught - not any other
12157
114823c8f3b0 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 12050
diff changeset
  8056
     doesNotUnderstand, and especially not any other error."
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8057
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8058
    |val ok|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8059
6146
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
  8060
    MessageNotUnderstood handle:[:ex |
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8061
        "/ reject, if the bad message is not the one
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8062
        "/ we have sent originally
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8063
        (ex selector == aSelector and:[ex receiver == self]) ifFalse:[
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8064
            ex reject
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8065
        ].
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8066
    ] do:[
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8067
        val := self perform:aSelector.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8068
        ok := true.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8069
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8070
    ok isNil ifTrue:[
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8071
        ^ exceptionBlock value
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8072
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8073
    ^ val
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8074
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8075
    "
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  8076
     1.2345 perform:#foo ifNotUnderstood:['sorry']
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  8077
     1.2345 perform:#sqrt ifNotUnderstood:['sorry']
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  8078
     12345 perform:#sqrt ifNotUnderstood:['sorry']
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8079
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8080
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8081
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8082
perform:aSelector with:argument ifNotUnderstood:exceptionBlock
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8083
    "try to send message aSelector to the receiver.
12157
114823c8f3b0 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 12050
diff changeset
  8084
     If its understood, return the method's returned value,
114823c8f3b0 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 12050
diff changeset
  8085
     otherwise return the value of the exceptionBlock.
114823c8f3b0 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 12050
diff changeset
  8086
     Read this:
114823c8f3b0 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 12050
diff changeset
  8087
     Many programmers do an Error-handle to perform a similar
114823c8f3b0 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 12050
diff changeset
  8088
     checked-message send. However, this method is more specific,
16560
Claus Gittinger <cg@exept.de>
parents: 16470
diff changeset
  8089
     in that only errors for the given selector are caught - not any other
12157
114823c8f3b0 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 12050
diff changeset
  8090
     doesNotUnderstand, and especially not any other error."
5755
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
    |val ok|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8093
8939
ac97eb450b97 Fix examples in #perform:*ifNotUnderstood:
Stefan Vogel <sv@exept.de>
parents: 8935
diff changeset
  8094
    MessageNotUnderstood handle:[:ex |
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8095
        "/ reject, if the bad message is not the one
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8096
        "/ we have sent originally
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8097
        (ex selector == aSelector and:[ex receiver == self]) ifFalse:[
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8098
            ex reject
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8099
        ]
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8100
    ] do:[
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8101
        val := self perform:aSelector with:argument.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8102
        ok := true.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8103
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8104
    ok isNil ifTrue:[
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8105
        ^ exceptionBlock value
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8106
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8107
    ^ val
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8108
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8109
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8110
     |unknown|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8111
8939
ac97eb450b97 Fix examples in #perform:*ifNotUnderstood:
Stefan Vogel <sv@exept.de>
parents: 8935
diff changeset
  8112
     unknown := 4.
ac97eb450b97 Fix examples in #perform:*ifNotUnderstood:
Stefan Vogel <sv@exept.de>
parents: 8935
diff changeset
  8113
     (unknown perform:#- with:2 ifNotUnderstood:['sorry']) printNewline.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8114
     unknown := 'high there'.
8939
ac97eb450b97 Fix examples in #perform:*ifNotUnderstood:
Stefan Vogel <sv@exept.de>
parents: 8935
diff changeset
  8115
     (unknown perform:#- with:2 ifNotUnderstood:['sorry']) printNewline.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8116
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8117
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8118
5926
e5ce56a2bd40 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5912
diff changeset
  8119
perform:aSelector with:arg1 with:arg2 ifNotUnderstood:exceptionBlock
e5ce56a2bd40 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5912
diff changeset
  8120
    "try to send message aSelector to the receiver.
12157
114823c8f3b0 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 12050
diff changeset
  8121
     If its understood, return the method's returned value,
114823c8f3b0 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 12050
diff changeset
  8122
     otherwise return the value of the exceptionBlock.
114823c8f3b0 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 12050
diff changeset
  8123
     Read this:
114823c8f3b0 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 12050
diff changeset
  8124
     Many programmers do an Error-handle to perform a similar
114823c8f3b0 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 12050
diff changeset
  8125
     checked-message send. However, this method is more specific,
16560
Claus Gittinger <cg@exept.de>
parents: 16470
diff changeset
  8126
     in that only errors for the given selector are caught - not any other
12157
114823c8f3b0 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 12050
diff changeset
  8127
     doesNotUnderstand, and especially not any other error."
5926
e5ce56a2bd40 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5912
diff changeset
  8128
e5ce56a2bd40 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5912
diff changeset
  8129
    |val ok|
e5ce56a2bd40 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5912
diff changeset
  8130
8939
ac97eb450b97 Fix examples in #perform:*ifNotUnderstood:
Stefan Vogel <sv@exept.de>
parents: 8935
diff changeset
  8131
    MessageNotUnderstood handle:[:ex |
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8132
        "/ reject, if the bad message is not the one
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8133
        "/ we have sent originally
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8134
        (ex selector == aSelector and:[ex receiver == self]) ifFalse:[
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8135
            ex reject
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8136
        ]
5926
e5ce56a2bd40 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5912
diff changeset
  8137
    ] do:[
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8138
        val := self perform:aSelector with:arg1 with:arg2.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8139
        ok := true.
5926
e5ce56a2bd40 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5912
diff changeset
  8140
    ].
e5ce56a2bd40 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5912
diff changeset
  8141
    ok isNil ifTrue:[
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8142
        ^ exceptionBlock value
5926
e5ce56a2bd40 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5912
diff changeset
  8143
    ].
e5ce56a2bd40 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5912
diff changeset
  8144
    ^ val
e5ce56a2bd40 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5912
diff changeset
  8145
!
e5ce56a2bd40 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5912
diff changeset
  8146
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8147
perform:aSelector withArguments:argumentArray ifNotUnderstood:exceptionBlock
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8148
    "try to send message aSelector to the receiver.
12157
114823c8f3b0 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 12050
diff changeset
  8149
     If its understood, return the method's returned value,
114823c8f3b0 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 12050
diff changeset
  8150
     otherwise return the value of the exceptionBlock.
114823c8f3b0 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 12050
diff changeset
  8151
     Read this:
114823c8f3b0 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 12050
diff changeset
  8152
     Many programmers do an Error-handle to perform a similar
114823c8f3b0 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 12050
diff changeset
  8153
     checked-message send. However, this method is more specific,
16560
Claus Gittinger <cg@exept.de>
parents: 16470
diff changeset
  8154
     in that only errors for the given selector are caught - not any other
12157
114823c8f3b0 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 12050
diff changeset
  8155
     doesNotUnderstand, and especially not any other error."
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8156
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8157
    |val ok|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8158
8939
ac97eb450b97 Fix examples in #perform:*ifNotUnderstood:
Stefan Vogel <sv@exept.de>
parents: 8935
diff changeset
  8159
    MessageNotUnderstood handle:[:ex |
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8160
        "/ reject, if the bad message is not the one
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8161
        "/ we have sent originally.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8162
        (ex selector == aSelector and:[ex receiver == self]) ifFalse:[
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8163
            ex reject
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8164
        ]
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8165
    ] do:[
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8166
        val := self perform:aSelector withArguments:argumentArray.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8167
        ok := true.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8168
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8169
    ok isNil ifTrue:[
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8170
        ^ exceptionBlock value
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8171
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8172
    ^ val
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8173
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8174
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8175
     |unknown|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8176
8939
ac97eb450b97 Fix examples in #perform:*ifNotUnderstood:
Stefan Vogel <sv@exept.de>
parents: 8935
diff changeset
  8177
     unknown := 4.
ac97eb450b97 Fix examples in #perform:*ifNotUnderstood:
Stefan Vogel <sv@exept.de>
parents: 8935
diff changeset
  8178
     (unknown perform:#- withArguments:#(2) ifNotUnderstood:['sorry']) printNewline.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8179
     unknown := 'high there'.
8939
ac97eb450b97 Fix examples in #perform:*ifNotUnderstood:
Stefan Vogel <sv@exept.de>
parents: 8935
diff changeset
  8180
     (unknown perform:#- withArguments:#(2) ifNotUnderstood:['sorry']) printNewline.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8181
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8182
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8183
    "Modified: 27.3.1997 / 14:13:16 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8184
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8185
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8186
!Object methodsFor:'signal constants'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8187
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8188
messageNotUnderstoodSignal
6146
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
  8189
    ^ MessageNotUnderstood
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
    "Created: 6.3.1997 / 15:46:52 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8192
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8193
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8194
!Object methodsFor:'special queries'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8195
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8196
allOwners
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8197
    "return a collection of all objects referencing the receiver"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8198
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8199
    ^ ObjectMemory whoReferences:self
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8200
!
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
references:anObject
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8203
    "return true, if the receiver refers to the argument, anObject.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8204
     - for debugging only"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8205
6074
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  8206
    ^ self referencesObject:anObject
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8207
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8208
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8209
     |v|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8210
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8211
     v := View new initialize.
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  8212
     v references:Display.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8213
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8214
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8215
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8216
referencesAny:aCollection
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  8217
    "return true, if the receiver refers to any object from
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8218
     the argument, aCollection.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8219
     - for debugging only"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8220
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  8221
%{
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8222
    OBJ cls, flags;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8223
    int nInsts, inst;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8224
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8225
    if (! __isNonNilObject(self)) {
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8226
        RETURN (false);
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8227
    }
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8228
8934
32a063645991 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8930
diff changeset
  8229
    if (__isArrayLike(aCollection)) {
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8230
        int nObjs = __arraySize(aCollection);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8231
        char *minAddr = 0, *maxAddr = 0;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8232
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8233
        if (nObjs == 0) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8234
            RETURN (false);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8235
        }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8236
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8237
        cls = __qClass(self);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8238
        flags = __ClassInstPtr(cls)->c_flags;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8239
        if (((INT)flags & __MASKSMALLINT(ARRAYMASK)) == __MASKSMALLINT(POINTERARRAY)) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8240
            nInsts = __BYTES2OBJS__(__qSize(self) - OHDR_SIZE);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8241
        } else {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8242
            nInsts = __intVal(__ClassInstPtr(cls)->c_ninstvars);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8243
        }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8244
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8245
        if (nObjs == 1) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8246
            /* better reverse the loop */
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8247
            OBJ anObject = __arrayVal(aCollection)[0];
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8248
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8249
            if (anObject == cls) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8250
                RETURN(true);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8251
            }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8252
            if (! nInsts) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8253
                RETURN (false);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8254
            }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8255
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8256
            if ((__qSpace(self) <= OLDSPACE)
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8257
                    && !__isRemembered(self)
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8258
                    && __isNonNilObject(anObject)) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8259
                int spc = __qSpace(anObject);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8260
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8261
                if ((spc == NEWSPACE) || (spc == SURVSPACE)) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8262
                    RETURN(false);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8263
                }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8264
            }
16325
aea5ba9d95a9 class: Object
Stefan Vogel <sv@exept.de>
parents: 16311
diff changeset
  8265
18231
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  8266
# if defined(memsrch4)
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8267
            if (memsrch4(__InstPtr(self)->i_instvars, (INT)anObject, nInsts)) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8268
                RETURN (true);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8269
            }
18231
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  8270
# else
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8271
            for (inst=0; inst<nInsts; inst++) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8272
                if ((__InstPtr(self)->i_instvars[inst]) == anObject) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8273
                    RETURN (true);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8274
                }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8275
            }
18231
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  8276
# endif
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8277
            RETURN (false);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8278
        }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8279
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8280
        /*
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8281
         * a little optimization: use the fact that all old objects
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8282
         * refering to a new object are on the remSet; if I am not,
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8283
         * a trivial reject is possible, if all objects are newbees.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8284
         * as a side effect, gather min/max addresses
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8285
         */
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8286
        if ((__qSpace(self) <= OLDSPACE) && !__isRemembered(self)) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8287
            int allNewBees = 1;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8288
            int i;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8289
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8290
            minAddr = (char *)(__arrayVal(aCollection)[0]);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8291
            maxAddr = minAddr;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8292
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8293
            for (i=0; i<nObjs; i++) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8294
                OBJ anObject = __arrayVal(aCollection)[i];
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8295
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8296
                if (__isNonNilObject(anObject)) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8297
                    int spc = __qSpace(anObject);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8298
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8299
                    if ((spc != NEWSPACE) && (spc != SURVSPACE)) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8300
                        allNewBees = 0;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8301
                    }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8302
                }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8303
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8304
                if ((char *)anObject < minAddr) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8305
                    minAddr = (char *)anObject;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8306
                } else if ((char *)anObject > maxAddr) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8307
                    maxAddr = (char *)anObject;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8308
                }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8309
            }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8310
            if (allNewBees) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8311
                RETURN (false);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8312
            }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8313
        }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8314
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8315
        /*
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8316
         * fetch min/max in searchList (if not already done above)
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8317
         */
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8318
        if (minAddr == 0) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8319
            int i;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8320
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8321
            for (i=0; i<nObjs; i++) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8322
                char  *anObject = (char *)__arrayVal(aCollection)[i];
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8323
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8324
                if (anObject < minAddr) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8325
                    minAddr = anObject;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8326
                } else if (anObject > maxAddr) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8327
                    maxAddr = anObject;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8328
                }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8329
            }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8330
        }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8331
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8332
        if (((char *)cls >= minAddr) && ((char *)cls <= maxAddr)) {
18231
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  8333
# if defined(memsrch4)
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8334
            if (memsrch4(__arrayVal(aCollection), (INT)cls, nObjs)) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8335
                RETURN (true);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8336
            }
18231
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  8337
# else
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8338
            int i;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8339
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8340
            for (i=0; i<nObjs; i++) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8341
                if (cls == __arrayVal(aCollection)[i]) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8342
                    RETURN (true);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8343
                }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8344
            }
18231
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  8345
# endif /* memsrch4 */
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8346
        }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8347
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8348
        for (inst=0; inst<nInsts; inst++) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8349
            OBJ instVar = __InstPtr(self)->i_instvars[inst];
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8350
            int i;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8351
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8352
            if (((char *)instVar >= minAddr) && ((char *)instVar <= maxAddr)) {
18231
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  8353
# if defined(memsrch4)
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8354
                if (memsrch4(__arrayVal(aCollection), (INT)instVar, nObjs)) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8355
                    RETURN (true);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8356
                }
18231
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  8357
# else
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8358
                for (i=0; i<nObjs; i++) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8359
                    if (instVar == __arrayVal(aCollection)[i]) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8360
                        RETURN (true);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8361
                    }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8362
                }
18231
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  8363
# endif /* memsrch4 */
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8364
            }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8365
        }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8366
        RETURN (false);
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8367
    }
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8368
%}.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8369
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8370
    aCollection do:[:el |
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8371
        (self referencesObject:el) ifTrue:[^ true].
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8372
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8373
    ^ false
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
referencesDerivedInstanceOf:aClass
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8377
    "return true, if the receiver refers to an instance of
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8378
     the argument, aClass or its subclass. This method exists
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8379
     to support searching for users of a class."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8380
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  8381
    |myClass
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8382
     numInst "{ Class: SmallInteger }" |
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8383
6631
5ffa1ce7b2cc #isExceptionCreator instead of #isSignal
Stefan Vogel <sv@exept.de>
parents: 6600
diff changeset
  8384
    "check the class"
5ffa1ce7b2cc #isExceptionCreator instead of #isSignal
Stefan Vogel <sv@exept.de>
parents: 6600
diff changeset
  8385
    (self isKindOf:aClass) ifTrue:[^ true].
5ffa1ce7b2cc #isExceptionCreator instead of #isSignal
Stefan Vogel <sv@exept.de>
parents: 6600
diff changeset
  8386
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8387
    myClass := self class.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8388
    "check the instance variables"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8389
    numInst := myClass instSize.
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  8390
    1 to:numInst do:[:i |
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8391
        ((self instVarAt:i) isKindOf:aClass) ifTrue:[^ true]
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8392
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8393
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8394
    "check the indexed variables"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8395
    myClass isVariable ifTrue:[
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8396
        myClass isPointers ifFalse:[
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8397
            "no need to search in non pointer fields"
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8398
            ((aClass == Number) or:[aClass isSubclassOf:Number]) ifFalse:[^ false].
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8399
        ].
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8400
        numInst := self basicSize.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8401
        1 to:numInst do:[:i |
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8402
            ((self basicAt:i) isKindOf:aClass) ifTrue:[^ true]
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8403
        ]
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8404
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8405
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8406
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8407
    "
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  8408
     (1 @ 3.4) referencesDerivedInstanceOf:Number
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  8409
     (1 @ 3.4) referencesDerivedInstanceOf:Array
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  8410
     View new initialize referencesDerivedInstanceOf:DeviceWorkstation
5755
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
9279
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  8414
referencesForWhich:checkBlock do:actionBlock
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  8415
    |myClass inst
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  8416
     numInst "{ Class: SmallInteger }" |
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  8417
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  8418
    myClass := self class.
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  8419
    "check the instance variables"
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  8420
    numInst := myClass instSize.
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  8421
    1 to:numInst do:[:i |
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8422
        inst := self instVarAt:i.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8423
        (checkBlock value:inst) ifTrue:[actionBlock value:inst].
9279
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  8424
    ].
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  8425
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  8426
    "check the indexed variables"
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  8427
    myClass isVariable ifTrue:[
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8428
        myClass isPointers ifTrue:[
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8429
            "no need to search in non pointer fields"
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8430
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8431
            numInst := self basicSize.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8432
            1 to:numInst do:[:i |
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8433
                inst := self basicAt:i.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8434
                (checkBlock value:inst) ifTrue:[actionBlock value:inst].
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8435
            ]
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8436
        ]
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  8437
    ].
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  8438
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  8439
    "
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  8440
     (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
  8441
    "
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  8442
!
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  8443
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8444
referencesInstanceOf:aClass
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8445
    "return true, if the receiver refers to an instance of
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8446
     the argument, aClass.This method exists
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8447
     to support searching for users of a class."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8448
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  8449
    |myClass
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8450
     numInst "{ Class: SmallInteger }" |
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
    myClass := self class.
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
    "check the class"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8455
    (myClass isMemberOf:aClass) ifTrue:[^ true].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8456
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8457
    "check the instance variables"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8458
    numInst := myClass instSize.
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  8459
    1 to:numInst do:[:i |
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8460
        ((self instVarAt:i) isMemberOf:aClass) ifTrue:[^ true]
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8461
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8462
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8463
    "check the indexed variables"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8464
    myClass isVariable ifTrue:[
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8465
        myClass isPointers ifFalse:[
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8466
            "no need to search in non-pointer indexed fields"
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8467
            myClass isLongs ifTrue:[
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8468
                (aClass == SmallInteger or:[aClass == LargeInteger]) ifFalse:[^ false].
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8469
            ] ifFalse:[
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8470
                myClass isFloatsOrDoubles ifTrue:[^ aClass == Float].
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8471
                ^ aClass == SmallInteger
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8472
            ]
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8473
        ].
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8474
        numInst := self basicSize.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8475
        1 to:numInst do:[:i |
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8476
            ((self basicAt:i) isMemberOf:aClass) ifTrue:[^ true]
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8477
        ]
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8478
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8479
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8480
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8481
    "
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  8482
     (1 @ 3.4) referencesInstanceOf:Float
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  8483
     (1 @ 3.4) referencesInstanceOf:Fraction
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  8484
     View new initialize referencesInstanceOf:(Display class)
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8485
    "
6074
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  8486
!
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  8487
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  8488
referencesObject:anObject
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  8489
    "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
  8490
     - for debugging only"
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  8491
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  8492
%{  /* NOCONTEXT */
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  8493
    OBJ cls, flags;
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  8494
    int nInsts, i;
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  8495
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  8496
    if (! __isNonNilObject(self)) {
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8497
        RETURN (false);
16325
aea5ba9d95a9 class: Object
Stefan Vogel <sv@exept.de>
parents: 16311
diff changeset
  8498
    }
aea5ba9d95a9 class: Object
Stefan Vogel <sv@exept.de>
parents: 16311
diff changeset
  8499
    cls = __qClass(self);
aea5ba9d95a9 class: Object
Stefan Vogel <sv@exept.de>
parents: 16311
diff changeset
  8500
    if (cls == anObject) {
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8501
        RETURN (true);
6074
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  8502
    }
16325
aea5ba9d95a9 class: Object
Stefan Vogel <sv@exept.de>
parents: 16311
diff changeset
  8503
    flags = __ClassInstPtr(cls)->c_flags;
aea5ba9d95a9 class: Object
Stefan Vogel <sv@exept.de>
parents: 16311
diff changeset
  8504
    if (((INT)flags & __MASKSMALLINT(ARRAYMASK)) == __MASKSMALLINT(POINTERARRAY)) {
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8505
        nInsts = __BYTES2OBJS__(__qSize(self) - OHDR_SIZE);
16325
aea5ba9d95a9 class: Object
Stefan Vogel <sv@exept.de>
parents: 16311
diff changeset
  8506
    } else {
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8507
        nInsts = __intVal(__ClassInstPtr(cls)->c_ninstvars);
16325
aea5ba9d95a9 class: Object
Stefan Vogel <sv@exept.de>
parents: 16311
diff changeset
  8508
    }
aea5ba9d95a9 class: Object
Stefan Vogel <sv@exept.de>
parents: 16311
diff changeset
  8509
    if (! nInsts) {
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8510
        RETURN (false);
16325
aea5ba9d95a9 class: Object
Stefan Vogel <sv@exept.de>
parents: 16311
diff changeset
  8511
    }
aea5ba9d95a9 class: Object
Stefan Vogel <sv@exept.de>
parents: 16311
diff changeset
  8512
6074
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  8513
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  8514
    /*
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  8515
     * 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
  8516
     * 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
  8517
     * 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
  8518
     */
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  8519
    if (__isNonNilObject(anObject)) {
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8520
        if ((__qSpace(self) <= OLDSPACE) && !__isRemembered(self)) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8521
            int spc;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8522
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8523
            if (((spc = __qSpace(anObject)) == NEWSPACE) || (spc == SURVSPACE)) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8524
                RETURN (false);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8525
            }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8526
        }
6074
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  8527
    }
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  8528
18231
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  8529
# if defined(memsrch4)
6074
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  8530
    if (memsrch4(__InstPtr(self)->i_instvars, (INT)anObject, nInsts)) {
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8531
        RETURN (true);
6074
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  8532
    }
18231
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  8533
# else
6074
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  8534
    for (i=0; i<nInsts; i++) {
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8535
        if (__InstPtr(self)->i_instvars[i] == anObject) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8536
            RETURN (true);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8537
        }
6074
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  8538
    }
18231
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  8539
# endif /* memsrch4 */
6074
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  8540
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  8541
%}.
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  8542
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  8543
"/    |myClass
6074
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  8544
"/     numInst "{ Class: SmallInteger }" |
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  8545
"/
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  8546
"/    myClass := self class.
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  8547
"/
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  8548
"/    "check the class"
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  8549
"/    (myClass == anObject) ifTrue:[^ true].
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  8550
"/
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  8551
"/    "check the instance variables"
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  8552
"/    numInst := myClass instSize.
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  8553
"/    1 to:numInst do:[:i |
6074
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  8554
"/      ((self instVarAt:i) == anObject) ifTrue:[^ true]
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  8555
"/    ].
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  8556
"/
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  8557
"/    "check the indexed variables"
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  8558
"/    myClass isVariable ifTrue:[
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  8559
"/      myClass isPointers ifFalse:[
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  8560
"/          "/
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  8561
"/          "/ 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
  8562
"/          "/ 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
  8563
"/          "/ 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
  8564
"/          "/ 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
  8565
"/          "/ 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
  8566
"/          "/ 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
  8567
"/          "/ 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
  8568
"/
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  8569
"/          ^ false.
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  8570
"/
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  8571
"/          "/ alternative:
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  8572
"/          "/  anObject isNumber ifFalse:[^ false].
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  8573
"/      ].
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  8574
"/
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  8575
"/      "/
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  8576
"/      "/ 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
  8577
"/      "/ idenitytIndex method, use it
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  8578
"/      "/
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  8579
"/      myClass == Array ifTrue:[
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  8580
"/          ^ (self identityIndexOf:anObject) ~~ 0
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  8581
"/      ].
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  8582
"/
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  8583
"/      "/
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  8584
"/      "/ otherwise, do it the slow way
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  8585
"/      "/
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  8586
"/      numInst := self basicSize.
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  8587
"/      1 to:numInst do:[:i |
6074
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  8588
"/          ((self basicAt:i) == anObject) ifTrue:[^ true]
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  8589
"/      ]
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  8590
"/    ].
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  8591
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  8592
    ^ false
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  8593
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  8594
    "
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  8595
     |v|
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  8596
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  8597
     v := View new initialize.
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  8598
     v references:Display.
6074
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  8599
    "
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8600
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8601
20027
5be764ee44fb #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 19846
diff changeset
  8602
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8603
!Object methodsFor:'synchronized evaluation'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8604
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  8605
freeSynchronizationSemaphore
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8606
    "free synchronizationSemaphore. May be used, to save memory when
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8607
     an object is no longer used synchronized."
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
    |sema|
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
    sema := self synchronizationSemaphore.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8612
    sema notNil ifTrue:[
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8613
        sema wait.              "/ get lock
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8614
        self synchronizationSemaphore:nil.
5755
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
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
     self synchronized:[].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8619
     self synchronizationSemaphore.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8620
     self freeSynchronizationSemaphore.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8621
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8622
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8623
    "Created: 28.1.1997 / 19:31:20 / stefan"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8624
    "Modified: 28.1.1997 / 19:47:55 / stefan"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8625
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8626
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8627
synchronizationSemaphore
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8628
    "return the synchronization semaphore for myself.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8629
     subclasses may redefine"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8630
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8631
    ^ SynchronizationSemaphores at:self ifAbsent:[].
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
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8634
      self synchronizationSemaphore
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8635
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8636
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8637
    "Modified: 28.1.1997 / 19:47:09 / stefan"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8638
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8639
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8640
synchronizationSemaphore:aSemaphore
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8641
    "set the synchronisationSemaphore for myself.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8642
     subclasses may redefine this method"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8643
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8644
    aSemaphore isNil ifTrue:[
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8645
        "/ remove Semaphore
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8646
        SynchronizationSemaphores removeKey:self ifAbsent:nil.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8647
    ] ifFalse:[
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8648
        SynchronizationSemaphores at:self put:aSemaphore.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8649
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8650
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8651
    "Modified: 28.1.1997 / 19:37:48 / stefan"
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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8654
synchronized:aBlock
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8655
    "evaluate aBlock synchronized, i.e. use a monitor for this object"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8656
6600
9c85adf293dd Simplify #synchronized:
Stefan Vogel <sv@exept.de>
parents: 6572
diff changeset
  8657
    |sema wasBlocked|
9c85adf293dd Simplify #synchronized:
Stefan Vogel <sv@exept.de>
parents: 6572
diff changeset
  8658
9c85adf293dd Simplify #synchronized:
Stefan Vogel <sv@exept.de>
parents: 6572
diff changeset
  8659
    wasBlocked := OperatingSystem blockInterrupts.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8660
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8661
    sema := self synchronizationSemaphore.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8662
    sema isNil ifTrue:[
18799
4ad4472385e5 #BUGFIX
Stefan Vogel <sv@exept.de>
parents: 18685
diff changeset
  8663
        sema := RecursionLock new name:self className.
4ad4472385e5 #BUGFIX
Stefan Vogel <sv@exept.de>
parents: 18685
diff changeset
  8664
        self synchronizationSemaphore:sema.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8665
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8666
6600
9c85adf293dd Simplify #synchronized:
Stefan Vogel <sv@exept.de>
parents: 6572
diff changeset
  8667
    wasBlocked ifFalse:[OperatingSystem unblockInterrupts].
18799
4ad4472385e5 #BUGFIX
Stefan Vogel <sv@exept.de>
parents: 18685
diff changeset
  8668
    ^ sema critical:aBlock.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8669
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
       [Object synchronized:[Delay waitForSeconds:2. Transcript showCR:'1']] fork.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8672
       [Object synchronized:[Delay waitForSeconds:2. Transcript showCR:'2']] fork.
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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8675
    "Created: 28.1.1997 / 17:52:56 / stefan"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8676
    "Modified: 30.1.1997 / 13:38:54 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8677
    "Modified: 20.2.1997 / 09:43:35 / stefan"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8678
! !
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
!Object methodsFor:'system primitives'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8681
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8682
asOop
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8683
    "ST-80 compatibility:
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8684
     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
  8685
     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
  8686
     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
  8687
     key, which provides (at least) some identity indication.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8688
     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
  8689
     key of two non-identical objects may be the same.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8690
     You'd better not use it - especially do not misuse it."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8691
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8692
    ^ self identityHash
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8693
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8694
    "Created: 9.11.1996 / 19:09:56 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8695
    "Modified: 9.11.1996 / 19:16:04 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8696
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8697
8939
ac97eb450b97 Fix examples in #perform:*ifNotUnderstood:
Stefan Vogel <sv@exept.de>
parents: 8935
diff changeset
  8698
beImmutable
ac97eb450b97 Fix examples in #perform:*ifNotUnderstood:
Stefan Vogel <sv@exept.de>
parents: 8935
diff changeset
  8699
    "experimental - not yet usable; do not use"
ac97eb450b97 Fix examples in #perform:*ifNotUnderstood:
Stefan Vogel <sv@exept.de>
parents: 8935
diff changeset
  8700
ac97eb450b97 Fix examples in #perform:*ifNotUnderstood:
Stefan Vogel <sv@exept.de>
parents: 8935
diff changeset
  8701
%{  /* NOCONTEXT */
ac97eb450b97 Fix examples in #perform:*ifNotUnderstood:
Stefan Vogel <sv@exept.de>
parents: 8935
diff changeset
  8702
    if (! __isNonNilObject(self)) {
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8703
        RETURN (self);
8939
ac97eb450b97 Fix examples in #perform:*ifNotUnderstood:
Stefan Vogel <sv@exept.de>
parents: 8935
diff changeset
  8704
    }
ac97eb450b97 Fix examples in #perform:*ifNotUnderstood:
Stefan Vogel <sv@exept.de>
parents: 8935
diff changeset
  8705
    __beImmutable(self);
ac97eb450b97 Fix examples in #perform:*ifNotUnderstood:
Stefan Vogel <sv@exept.de>
parents: 8935
diff changeset
  8706
%}
ac97eb450b97 Fix examples in #perform:*ifNotUnderstood:
Stefan Vogel <sv@exept.de>
parents: 8935
diff changeset
  8707
!
ac97eb450b97 Fix examples in #perform:*ifNotUnderstood:
Stefan Vogel <sv@exept.de>
parents: 8935
diff changeset
  8708
ac97eb450b97 Fix examples in #perform:*ifNotUnderstood:
Stefan Vogel <sv@exept.de>
parents: 8935
diff changeset
  8709
beMutable
ac97eb450b97 Fix examples in #perform:*ifNotUnderstood:
Stefan Vogel <sv@exept.de>
parents: 8935
diff changeset
  8710
    "experimental - not yet usable; do not use"
ac97eb450b97 Fix examples in #perform:*ifNotUnderstood:
Stefan Vogel <sv@exept.de>
parents: 8935
diff changeset
  8711
ac97eb450b97 Fix examples in #perform:*ifNotUnderstood:
Stefan Vogel <sv@exept.de>
parents: 8935
diff changeset
  8712
%{  /* NOCONTEXT */
ac97eb450b97 Fix examples in #perform:*ifNotUnderstood:
Stefan Vogel <sv@exept.de>
parents: 8935
diff changeset
  8713
    if (! __isNonNilObject(self)) {
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8714
        RETURN (self);
8939
ac97eb450b97 Fix examples in #perform:*ifNotUnderstood:
Stefan Vogel <sv@exept.de>
parents: 8935
diff changeset
  8715
    }
ac97eb450b97 Fix examples in #perform:*ifNotUnderstood:
Stefan Vogel <sv@exept.de>
parents: 8935
diff changeset
  8716
    __beMutable(self);
ac97eb450b97 Fix examples in #perform:*ifNotUnderstood:
Stefan Vogel <sv@exept.de>
parents: 8935
diff changeset
  8717
%}
ac97eb450b97 Fix examples in #perform:*ifNotUnderstood:
Stefan Vogel <sv@exept.de>
parents: 8935
diff changeset
  8718
!
ac97eb450b97 Fix examples in #perform:*ifNotUnderstood:
Stefan Vogel <sv@exept.de>
parents: 8935
diff changeset
  8719
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8720
become:anotherObject
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8721
    "make all references to the receiver become references to anotherObject
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8722
     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
  8723
     This can be a very dangerous operation - be warned.
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  8724
     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
  8725
     produce many strange effects (think of hashing in Sets, Dictionaries etc.).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8726
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  8727
     This may also be an expensive (i.e. slow) operation,
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  8728
     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
  8729
     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
  8730
     limit the search, for acceptable performance in most cases).
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  8731
     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
  8732
     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
  8733
     returned).
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  8734
     (notice that #become: is not used heavily by the system
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8735
      - the Collection-classes have been rewritten to not use it.)"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8736
%{
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8737
    if (__primBecome(self, anotherObject)) {
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8738
        RETURN ( self );
5755
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
%}.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8741
    self primitiveFailed
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8742
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8743
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8744
becomeNil
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8745
    "make all references to the receiver become nil - effectively getting
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  8746
     rid of the receiver.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8747
     This can be a very dangerous operation - be warned.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8748
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8749
     This may be an expensive (i.e. slow) operation.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8750
     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
  8751
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8752
%{
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8753
    if (__primBecomeNil(self)) {
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8754
        RETURN ( nil );
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8755
    }
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8756
%}.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8757
    self primitiveFailed
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8758
!
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
becomeSameAs:anotherObject
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8761
    "make all references to the receiver become references to anotherObject
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8762
     but NOT vice versa (as done in #become:).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8763
     This can be a very dangerous operation - be warned.
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  8764
     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
  8765
     produce many strange effects (think of hashing in Sets, Dictionaries etc.).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8766
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8767
     This may also be an expensive (i.e. slow) operation,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8768
     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
  8769
     references to the two objects (although the primitive tries hard to
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8770
     limit the search, for acceptable performance in most cases).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8771
     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
  8772
     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
  8773
%{
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8774
    if (__primBecomeSameAs(self, anotherObject)) {
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8775
        RETURN ( self );
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8776
    }
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8777
%}.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8778
    self primitiveFailed
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8779
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8780
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8781
changeClassTo:otherClass
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8782
    "changes the class of the receiver to the argument, otherClass.
19451
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  8783
     This is only allowed (possible), if the receiver's class and the argument
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8784
     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
  8785
     type of indexed instance variables).
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8786
     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
  8787
     is UndefinedObject or a Smallinteger, a primitive error is triggered."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8788
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8789
    |myClass ok|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8790
9405
cdeae08708cd comments
Stefan Vogel <sv@exept.de>
parents: 9375
diff changeset
  8791
    otherClass autoload.
cdeae08708cd comments
Stefan Vogel <sv@exept.de>
parents: 9375
diff changeset
  8792
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8793
    "check for UndefinedObject/SmallInteger receiver or newClass"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8794
%{
18371
fa96aa321a0a comments only
Claus Gittinger <cg@exept.de>
parents: 18361
diff changeset
  8795
#ifdef __SCHTEAM__
fa96aa321a0a comments only
Claus Gittinger <cg@exept.de>
parents: 18361
diff changeset
  8796
    ok = (self.isSTInstance() && otherClass.isSTInstance())
19451
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  8797
            ? STObject.True : STObject.False;
18371
fa96aa321a0a comments only
Claus Gittinger <cg@exept.de>
parents: 18361
diff changeset
  8798
#else
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8799
    {
19451
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  8800
        OBJ other = otherClass;
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  8801
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  8802
        if (__isNonNilObject(self)
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  8803
         && __isNonNilObject(other)
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  8804
         && (other != UndefinedObject)
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  8805
         && (other != SmallInteger)) {
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  8806
            ok = true;
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  8807
        } else {
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  8808
            ok = false;
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  8809
        }
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8810
    }
18371
fa96aa321a0a comments only
Claus Gittinger <cg@exept.de>
parents: 18361
diff changeset
  8811
#endif /* not SCHTEAM */
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8812
%}.
18231
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  8813
    ok == true ifTrue:[
19451
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  8814
        ok := false.
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  8815
        myClass := self class.
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  8816
        myClass == otherClass ifTrue:[
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  8817
            "nothing to change"
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  8818
            ^ self.
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  8819
        ].
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  8820
        myClass flags == otherClass flags ifTrue:[
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  8821
            myClass instSize == otherClass instSize ifTrue:[
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  8822
                "same instance layout and types: its ok to do it"
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  8823
                ok := true.
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  8824
            ] ifFalse:[
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  8825
                myClass isPointers ifTrue:[
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  8826
                    myClass isVariable ifTrue:[
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  8827
                        ok := true
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  8828
                    ]
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  8829
                ]
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  8830
            ]
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  8831
        ] ifFalse:[
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  8832
            myClass isPointers ifTrue:[
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  8833
                "if newClass is a variable class, with instSize <= my instsize,
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  8834
                 we can do it (effectively mapping additional instvars into the
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  8835
                 variable part) - usefulness is questionable, though"
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  8836
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  8837
                otherClass isPointers ifTrue:[
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  8838
                    otherClass isVariable ifTrue:[
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  8839
                        otherClass instSize <= (myClass instSize + self basicSize)
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  8840
                        ifTrue:[
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  8841
                            ok := true
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  8842
                        ]
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  8843
                    ] ifFalse:[
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  8844
                        otherClass instSize == (myClass instSize + self basicSize)
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  8845
                        ifTrue:[
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  8846
                            ok := true
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  8847
                        ]
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  8848
                    ]
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  8849
                ] ifFalse:[
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  8850
                    "it does not make sense to convert pointers to bytes ..."
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  8851
                ]
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  8852
            ] ifFalse:[
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  8853
                "does it make sense, to convert bits ?"
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  8854
                "could allow byteArray->wordArray->longArray->floatArray->doubleArray here ..."
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  8855
                (myClass isBitsExtended and:[otherClass isBitsExtended]) ifTrue:[
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  8856
                    ok := true
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  8857
                ]
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  8858
            ]
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  8859
        ]
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8860
    ].
18231
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  8861
    ok == true ifTrue:[
19451
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  8862
        "now, change the receiver's class ..."
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8863
%{
18371
fa96aa321a0a comments only
Claus Gittinger <cg@exept.de>
parents: 18361
diff changeset
  8864
#ifdef __SCHTEAM__
19451
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  8865
        ((STInstance)self).clazz = (STClass)otherClass;
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  8866
        return __c__._RETURN(self);
18371
fa96aa321a0a comments only
Claus Gittinger <cg@exept.de>
parents: 18361
diff changeset
  8867
#else
19451
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  8868
        {
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  8869
            OBJ me = self;
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  8870
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  8871
            // gcc4.4 does not like this:
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  8872
            // __qClass(me) = otherClass;
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  8873
            __objPtr(me)->o_class = (CLASS_OBJ)otherClass;
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  8874
            __STORE(me, otherClass);
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  8875
            RETURN (me);
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  8876
        }
18371
fa96aa321a0a comments only
Claus Gittinger <cg@exept.de>
parents: 18361
diff changeset
  8877
#endif /* not SCHTEAM */
5755
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
    ].
9405
cdeae08708cd comments
Stefan Vogel <sv@exept.de>
parents: 9375
diff changeset
  8880
5755
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
     the receiver cannot be represented as a instance of
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8883
     the desired class.
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  8884
     For example, you cannot change a bitInstance (byteArray etc.)
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8885
     into a pointer object and vice versa.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8886
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8887
    self primitiveFailed
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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8890
changeClassToThatOf:anObject
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8891
    "changes the class of the receiver to that of the argument, anObject.
19451
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  8892
     This is only allowed (possible), if the receiver's class and the arguments
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  8893
     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
  8894
     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
  8895
     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
  8896
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8897
    self changeClassTo:(anObject class)
6033
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  8898
!
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  8899
8935
f770c55ba40e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8934
diff changeset
  8900
isImmutable
f770c55ba40e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8934
diff changeset
  8901
    "experimental - not yet usable; do not use"
f770c55ba40e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8934
diff changeset
  8902
f770c55ba40e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8934
diff changeset
  8903
%{  /* NOCONTEXT */
f770c55ba40e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8934
diff changeset
  8904
    if (! __isNonNilObject(self)) {
19646
b078054423fb #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19583
diff changeset
  8905
        RETURN (true);
8935
f770c55ba40e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8934
diff changeset
  8906
    }
19646
b078054423fb #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19583
diff changeset
  8907
    if (__isImmutable(self)) {
b078054423fb #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19583
diff changeset
  8908
        RETURN (true);
b078054423fb #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19583
diff changeset
  8909
    }
b078054423fb #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19583
diff changeset
  8910
%}.
b078054423fb #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19583
diff changeset
  8911
    ^ false
8935
f770c55ba40e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8934
diff changeset
  8912
!
f770c55ba40e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8934
diff changeset
  8913
6033
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  8914
replaceReferencesTo:anObject with:newRef
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  8915
    "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
  8916
     Return true, if any reference was changed.
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  8917
     Notice: this does not change the class-reference."
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  8918
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  8919
%{  /* NOCONTEXT */
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  8920
    OBJ cls, flags, anyChange;
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  8921
    int nInsts, i;
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  8922
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  8923
    if (! __isNonNilObject(self)) {
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8924
        RETURN (false);
6033
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  8925
    }
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  8926
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  8927
    /*
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  8928
     * a little optimization: use the fact that all old objects
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  8929
     * 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
  8930
     * a trivial reject is possible, if anObject is a newbee
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  8931
     */
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  8932
    if (__isNonNilObject(anObject)) {
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8933
        if ((__qSpace(self) <= OLDSPACE) && !__isRemembered(self)) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8934
            int spc;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8935
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8936
            if (((spc = __qSpace(anObject)) == NEWSPACE) || (spc == SURVSPACE)) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8937
                RETURN (false);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8938
            }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8939
        }
6033
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  8940
    }
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  8941
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  8942
    cls = __qClass(self);
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  8943
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  8944
    flags = __ClassInstPtr(cls)->c_flags;
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  8945
    if (((INT)flags & __MASKSMALLINT(ARRAYMASK)) == __MASKSMALLINT(POINTERARRAY)) {
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8946
        nInsts = __BYTES2OBJS__(__qSize(self) - OHDR_SIZE);
6033
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  8947
    } else {
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8948
        nInsts = __intVal(__ClassInstPtr(cls)->c_ninstvars);
6033
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  8949
    }
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  8950
    if (! nInsts) {
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8951
        RETURN (false);
6033
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  8952
    }
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  8953
    anyChange = false;
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  8954
    for (i=0; i<nInsts; i++) {
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8955
        if (__InstPtr(self)->i_instvars[i] == anObject) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8956
            __InstPtr(self)->i_instvars[i] = newRef;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8957
            __STORE(self, newRef);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8958
            // __dumpObject__(self, __LINE__);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8959
            anyChange = true;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  8960
        }
6033
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  8961
    }
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  8962
    RETURN (anyChange);
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  8963
%}.
18231
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  8964
    self primitiveFailed
6033
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  8965
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  8966
    "
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  8967
     |v|
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  8968
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  8969
     v := Array with:1234 with:'hello' with:Array.
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  8970
     v replaceReferencesTo:Array with:ByteArray.
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  8971
     v inspect
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  8972
    "
15586
ac2e51b3000c class: Object
Claus Gittinger <cg@exept.de>
parents: 15519
diff changeset
  8973
ac2e51b3000c class: Object
Claus Gittinger <cg@exept.de>
parents: 15519
diff changeset
  8974
    "Modified: / 30-07-2013 / 21:48:06 / cg"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8975
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8976
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8977
!Object methodsFor:'testing'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8978
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8979
? defaultValue
11634
657c12384132 Fix spelling
Stefan Vogel <sv@exept.de>
parents: 11573
diff changeset
  8980
     "a syntactic sugar-piece:
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8981
      if the receiver is nil, return the defaultValue;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8982
      otherwise, return the receiver.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8983
      This method is only redefined in UndefinedObject - therefore,
19451
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  8984
      the receiver is retuned here.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8985
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8986
      Thus, if foo and bar are simple variables or constants,
19451
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  8987
          foo ? bar
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8988
      is the same as:
19451
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  8989
          (foo isNil ifTrue:[bar] ifFalse:[foo])
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8990
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8991
      if they are message sends, the equivalent code is:
19451
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  8992
          [
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  8993
              |t1 t2|
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  8994
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  8995
              t1 := foo.
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  8996
              t2 := bar.
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  8997
              t1 isNil ifTrue:[t2] ifFalse:[t1]
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  8998
          ] value
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8999
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9000
      Can be used to provide defaultValues to variables,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9001
      as in:
19451
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  9002
          foo := arg ? #defaultValue
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9003
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9004
      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
  9005
      Notice:
19451
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  9006
         This method is open coded (inlined) by the compiler(s)
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  9007
         - redefining it may not work as expected."
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9008
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9009
    ^ self
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9010
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9011
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9012
     1 ? #default
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9013
     nil ? #default
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
    "Created: / 4.11.1996 / 20:36:19 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9017
    "Modified: / 19.5.1998 / 17:39:56 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9018
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9019
16126
bd5dd5e03278 class: Object
Stefan Vogel <sv@exept.de>
parents: 16125
diff changeset
  9020
?+ aOneArgBlock
bd5dd5e03278 class: Object
Stefan Vogel <sv@exept.de>
parents: 16125
diff changeset
  9021
     "a syntactic sugar-piece:
bd5dd5e03278 class: Object
Stefan Vogel <sv@exept.de>
parents: 16125
diff changeset
  9022
      aOneArgBlock is executed with self as argument
bd5dd5e03278 class: Object
Stefan Vogel <sv@exept.de>
parents: 16125
diff changeset
  9023
      if self is not nil.
bd5dd5e03278 class: Object
Stefan Vogel <sv@exept.de>
parents: 16125
diff changeset
  9024
bd5dd5e03278 class: Object
Stefan Vogel <sv@exept.de>
parents: 16125
diff changeset
  9025
      Note: this method should never be redefined in classes other than UndefinedObject.
bd5dd5e03278 class: Object
Stefan Vogel <sv@exept.de>
parents: 16125
diff changeset
  9026
     "
bd5dd5e03278 class: Object
Stefan Vogel <sv@exept.de>
parents: 16125
diff changeset
  9027
bd5dd5e03278 class: Object
Stefan Vogel <sv@exept.de>
parents: 16125
diff changeset
  9028
    ^ aOneArgBlock value:self
bd5dd5e03278 class: Object
Stefan Vogel <sv@exept.de>
parents: 16125
diff changeset
  9029
bd5dd5e03278 class: Object
Stefan Vogel <sv@exept.de>
parents: 16125
diff changeset
  9030
    "
bd5dd5e03278 class: Object
Stefan Vogel <sv@exept.de>
parents: 16125
diff changeset
  9031
     1 ?+ [:v| v + 5]
bd5dd5e03278 class: Object
Stefan Vogel <sv@exept.de>
parents: 16125
diff changeset
  9032
     nil ?+ [:v| v + 5]
bd5dd5e03278 class: Object
Stefan Vogel <sv@exept.de>
parents: 16125
diff changeset
  9033
    "
bd5dd5e03278 class: Object
Stefan Vogel <sv@exept.de>
parents: 16125
diff changeset
  9034
!
bd5dd5e03278 class: Object
Stefan Vogel <sv@exept.de>
parents: 16125
diff changeset
  9035
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9036
?? defaultValue
11634
657c12384132 Fix spelling
Stefan Vogel <sv@exept.de>
parents: 11573
diff changeset
  9037
     "a syntactic sugar-piece:
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9038
      much like ?, but sends #value to the argument if required.
15758
30c2f111a661 class: Object
Claus Gittinger <cg@exept.de>
parents: 15723
diff changeset
  9039
      (i.e. it's the same as #ifNil:)
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9040
      If the receiver is nil, return the defaultValues value;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9041
      otherwise, return the receiver.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9042
      This method is only redefined in UndefinedObject - therefore,
15758
30c2f111a661 class: Object
Claus Gittinger <cg@exept.de>
parents: 15723
diff changeset
  9043
      the receiver is retuned here.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9044
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9045
      Thus, if foo and bar are simple variables or constants,
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  9046
          foo ?? bar
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9047
      is the same as:
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  9048
          (foo isNil ifTrue:[bar value] ifFalse:[foo])
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9049
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9050
      if they are message sends, the equivalent code is:
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  9051
          [
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  9052
              |t t2|
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  9053
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  9054
              t := foo.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  9055
              t isNil ifTrue:[bar value] ifFalse:[t]
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  9056
          ] value
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9057
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9058
      Can be used to provide defaultValues to variables,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9059
      as in:
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  9060
          foo := arg ?? [ self computeDefault ]
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9061
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9062
      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
  9063
     "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9064
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9065
    ^ self
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
    "
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  9068
     1 ?? #default
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9069
     nil ?? #default
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  9070
     1 ?? [ self halt. 1 + 2 ]
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  9071
     nil ?? [ self halt. 1 + 2 ]
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  9072
     1 ?? [Date today]
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  9073
     nil ?? [Date today]
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9074
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9075
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9076
    "Created: / 4.11.1996 / 20:36:19 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9077
    "Modified: / 19.5.1998 / 17:42:56 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9078
!
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
ifNil:aBlockOrValue
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9081
    "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
  9082
     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
  9083
     receiver.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9084
     Notice:
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  9085
        This method is open coded (inlined) by the compiler(s)
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  9086
        - redefining it may not work as expected."
5755
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
    ^ self
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9089
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9090
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9091
ifNil:nilBlockOrValue ifNotNil:notNilBlockOrValue
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9092
    "return the value of the first arg, if I am nil,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9093
     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
  9094
     Notice:
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  9095
        This method is open coded (inlined) by the compiler(s)
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  9096
        - redefining it may not work as expected."
18440
dc5cde224664 class: Object
Stefan Vogel <sv@exept.de>
parents: 18422
diff changeset
  9097
dc5cde224664 class: Object
Stefan Vogel <sv@exept.de>
parents: 18422
diff changeset
  9098
    (notNilBlockOrValue isBlock and:[notNilBlockOrValue argumentCount == 1]) ifTrue:[
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  9099
        ^ notNilBlockOrValue value:self.
15501
43d3929a8fc0 class: Object
Claus Gittinger <cg@exept.de>
parents: 15449
diff changeset
  9100
    ].
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9101
    ^ notNilBlockOrValue value
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9102
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9103
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9104
ifNotNil:aBlockOrValue
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  9105
    "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
  9106
     if I am not nil.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9107
     Notice:
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  9108
        This method is open coded (inlined) by the compiler(s)
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  9109
        - redefining it may not work as expected."
18440
dc5cde224664 class: Object
Stefan Vogel <sv@exept.de>
parents: 18422
diff changeset
  9110
dc5cde224664 class: Object
Stefan Vogel <sv@exept.de>
parents: 18422
diff changeset
  9111
    (aBlockOrValue isBlock and:[aBlockOrValue argumentCount == 1]) ifTrue:[
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  9112
        ^ aBlockOrValue value:self.
15501
43d3929a8fc0 class: Object
Claus Gittinger <cg@exept.de>
parents: 15449
diff changeset
  9113
    ].
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9114
    ^ aBlockOrValue value
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9115
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9116
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9117
ifNotNil:notNilBlockOrValue ifNil:nilBlockOrValue
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9118
    "return the value of the 2nd arg, if I am nil,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9119
     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
  9120
     Notice:
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  9121
        This method is open coded (inlined) by the compiler(s)
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  9122
        - redefining it may not work as expected."
18440
dc5cde224664 class: Object
Stefan Vogel <sv@exept.de>
parents: 18422
diff changeset
  9123
dc5cde224664 class: Object
Stefan Vogel <sv@exept.de>
parents: 18422
diff changeset
  9124
    (notNilBlockOrValue isBlock and:[notNilBlockOrValue argumentCount == 1]) ifTrue:[
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  9125
        ^ notNilBlockOrValue value:self.
15501
43d3929a8fc0 class: Object
Claus Gittinger <cg@exept.de>
parents: 15449
diff changeset
  9126
    ].
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9127
    ^ notNilBlockOrValue value
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
8574
33bb637901eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8563
diff changeset
  9130
ifNotNilDo:aBlock
33bb637901eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8563
diff changeset
  9131
    "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
  9132
     Otherwise do nothing and return nil."
33bb637901eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8563
diff changeset
  9133
33bb637901eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8563
diff changeset
  9134
    ^ aBlock value:self
33bb637901eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8563
diff changeset
  9135
!
33bb637901eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8563
diff changeset
  9136
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9137
isArray
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9138
    "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
  9139
     false is returned here - the method is only redefined in Array."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9140
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9141
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9142
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9143
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9144
isAssociation
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9145
    "return true, if the receiver is some kind of association;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9146
     false is returned here - the method is only redefined in Association."
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
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9149
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9150
    "Created: 14.5.1996 / 17:03:45 / cg"
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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9153
isBehavior
18352
9f4843dad9d3 class: Object
Claus Gittinger <cg@exept.de>
parents: 18319
diff changeset
  9154
    "return true, if the receiver is describing another object's behavior.
9221
d8fff4a78065 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9216
diff changeset
  9155
     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
  9156
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9157
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9158
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9159
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9160
isBlock
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9161
    "return true, if the receiver is some kind of block;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9162
     false returned here - the method is only redefined in Block."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9163
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9164
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9165
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9166
5824
fdf9cd50a141 Added method isBoolean; need this!
martin
parents: 5821
diff changeset
  9167
isBoolean
fdf9cd50a141 Added method isBoolean; need this!
martin
parents: 5821
diff changeset
  9168
    "return true, if the receiver is a boolean;
fdf9cd50a141 Added method isBoolean; need this!
martin
parents: 5821
diff changeset
  9169
     false is returned here - the method is only redefined in Boolean."
fdf9cd50a141 Added method isBoolean; need this!
martin
parents: 5821
diff changeset
  9170
fdf9cd50a141 Added method isBoolean; need this!
martin
parents: 5821
diff changeset
  9171
    ^ false
fdf9cd50a141 Added method isBoolean; need this!
martin
parents: 5821
diff changeset
  9172
!
fdf9cd50a141 Added method isBoolean; need this!
martin
parents: 5821
diff changeset
  9173
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9174
isByteArray
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9175
    "return true, if the receiver is some kind of bytearray;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9176
     false is returned here - the method is only redefined in ByteArray."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9177
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9178
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9179
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9180
8986
c2962d45eca0 new: #isByteCollection
Stefan Vogel <sv@exept.de>
parents: 8977
diff changeset
  9181
isByteCollection
c2962d45eca0 new: #isByteCollection
Stefan Vogel <sv@exept.de>
parents: 8977
diff changeset
  9182
    "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
  9183
     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
  9184
     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
  9185
8986
c2962d45eca0 new: #isByteCollection
Stefan Vogel <sv@exept.de>
parents: 8977
diff changeset
  9186
     false is returned here - the method is only redefined in UninterpretedBytes."
c2962d45eca0 new: #isByteCollection
Stefan Vogel <sv@exept.de>
parents: 8977
diff changeset
  9187
c2962d45eca0 new: #isByteCollection
Stefan Vogel <sv@exept.de>
parents: 8977
diff changeset
  9188
    ^ false
c2962d45eca0 new: #isByteCollection
Stefan Vogel <sv@exept.de>
parents: 8977
diff changeset
  9189
!
c2962d45eca0 new: #isByteCollection
Stefan Vogel <sv@exept.de>
parents: 8977
diff changeset
  9190
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9191
isCharacter
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9192
    "return true, if the receiver is some kind of character;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9193
     false is returned here - the method is only redefined in Character."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9194
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9195
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9196
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9197
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9198
isClass
9405
cdeae08708cd comments
Stefan Vogel <sv@exept.de>
parents: 9375
diff changeset
  9199
    "return true, if the receiver is some kind of class
cdeae08708cd comments
Stefan Vogel <sv@exept.de>
parents: 9375
diff changeset
  9200
     (real class, not just behavior);
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9201
     false is returned here - the method is only redefined in Class."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9202
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9203
    ^ false
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
isCollection
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9207
    "return true, if the receiver is some kind of collection;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9208
     false is returned here - the method is only redefined in Collection."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9209
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9210
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9211
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9212
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9213
isColor
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9214
    "return true, if the receiver is some kind of color;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9215
     false is returned here - the method is only redefined in Color."
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
    ^ false
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
6567
cba5c3103600 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6549
diff changeset
  9220
isCons
cba5c3103600 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6549
diff changeset
  9221
    "return true, if the receiver is a cons (pair);
cba5c3103600 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6549
diff changeset
  9222
     false is returned here - the method is only redefined in Cons."
cba5c3103600 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6549
diff changeset
  9223
cba5c3103600 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6549
diff changeset
  9224
    ^ false
cba5c3103600 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6549
diff changeset
  9225
!
cba5c3103600 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6549
diff changeset
  9226
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9227
isContext
15362
f64a9683658b class: Object
Claus Gittinger <cg@exept.de>
parents: 15255
diff changeset
  9228
    "return true, if the receiver is some kind of Context;
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9229
     false returned here - the method is only redefined in Context."
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
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9232
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9233
15362
f64a9683658b class: Object
Claus Gittinger <cg@exept.de>
parents: 15255
diff changeset
  9234
isDictionary
f64a9683658b class: Object
Claus Gittinger <cg@exept.de>
parents: 15255
diff changeset
  9235
    "return true, if the receiver is some kind of dictionary;
f64a9683658b class: Object
Claus Gittinger <cg@exept.de>
parents: 15255
diff changeset
  9236
     false returned here - the method is only redefined in Dictionary."
f64a9683658b class: Object
Claus Gittinger <cg@exept.de>
parents: 15255
diff changeset
  9237
f64a9683658b class: Object
Claus Gittinger <cg@exept.de>
parents: 15255
diff changeset
  9238
    ^ false
f64a9683658b class: Object
Claus Gittinger <cg@exept.de>
parents: 15255
diff changeset
  9239
!
f64a9683658b class: Object
Claus Gittinger <cg@exept.de>
parents: 15255
diff changeset
  9240
6181
5876cc789e41 + isEmptyOrNil
Claus Gittinger <cg@exept.de>
parents: 6175
diff changeset
  9241
isEmptyOrNil
8833
717b01292d0e comments
Stefan Vogel <sv@exept.de>
parents: 8832
diff changeset
  9242
    "return true if I am nil or an empty collection - return false here.
717b01292d0e comments
Stefan Vogel <sv@exept.de>
parents: 8832
diff changeset
  9243
     (from Squeak)"
6181
5876cc789e41 + isEmptyOrNil
Claus Gittinger <cg@exept.de>
parents: 6175
diff changeset
  9244
5876cc789e41 + isEmptyOrNil
Claus Gittinger <cg@exept.de>
parents: 6175
diff changeset
  9245
    ^ false
5876cc789e41 + isEmptyOrNil
Claus Gittinger <cg@exept.de>
parents: 6175
diff changeset
  9246
5876cc789e41 + isEmptyOrNil
Claus Gittinger <cg@exept.de>
parents: 6175
diff changeset
  9247
    "Created: / 13.11.2001 / 13:17:04 / cg"
6182
2b992cf865bc comment
Claus Gittinger <cg@exept.de>
parents: 6181
diff changeset
  9248
    "Modified: / 13.11.2001 / 13:28:40 / cg"
6181
5876cc789e41 + isEmptyOrNil
Claus Gittinger <cg@exept.de>
parents: 6175
diff changeset
  9249
!
5876cc789e41 + isEmptyOrNil
Claus Gittinger <cg@exept.de>
parents: 6175
diff changeset
  9250
6221
404495587300 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6203
diff changeset
  9251
isException
15362
f64a9683658b class: Object
Claus Gittinger <cg@exept.de>
parents: 15255
diff changeset
  9252
    "answer true, if this is an Exception"
6631
5ffa1ce7b2cc #isExceptionCreator instead of #isSignal
Stefan Vogel <sv@exept.de>
parents: 6600
diff changeset
  9253
6221
404495587300 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6203
diff changeset
  9254
    ^ false
404495587300 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6203
diff changeset
  9255
404495587300 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6203
diff changeset
  9256
    "Created: / 17.11.2001 / 18:37:44 / cg"
404495587300 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6203
diff changeset
  9257
!
404495587300 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6203
diff changeset
  9258
6631
5ffa1ce7b2cc #isExceptionCreator instead of #isSignal
Stefan Vogel <sv@exept.de>
parents: 6600
diff changeset
  9259
isExceptionCreator
5ffa1ce7b2cc #isExceptionCreator instead of #isSignal
Stefan Vogel <sv@exept.de>
parents: 6600
diff changeset
  9260
    "return true, if the receiver can create exceptions,
5ffa1ce7b2cc #isExceptionCreator instead of #isSignal
Stefan Vogel <sv@exept.de>
parents: 6600
diff changeset
  9261
     this includes #raise, #raiseRequest as well as the behavior of
5ffa1ce7b2cc #isExceptionCreator instead of #isSignal
Stefan Vogel <sv@exept.de>
parents: 6600
diff changeset
  9262
     an exception handler, such as the #accepts: and #handles: messages"
5ffa1ce7b2cc #isExceptionCreator instead of #isSignal
Stefan Vogel <sv@exept.de>
parents: 6600
diff changeset
  9263
5ffa1ce7b2cc #isExceptionCreator instead of #isSignal
Stefan Vogel <sv@exept.de>
parents: 6600
diff changeset
  9264
    ^ false
5ffa1ce7b2cc #isExceptionCreator instead of #isSignal
Stefan Vogel <sv@exept.de>
parents: 6600
diff changeset
  9265
!
5ffa1ce7b2cc #isExceptionCreator instead of #isSignal
Stefan Vogel <sv@exept.de>
parents: 6600
diff changeset
  9266
5ffa1ce7b2cc #isExceptionCreator instead of #isSignal
Stefan Vogel <sv@exept.de>
parents: 6600
diff changeset
  9267
isExceptionHandler
5ffa1ce7b2cc #isExceptionCreator instead of #isSignal
Stefan Vogel <sv@exept.de>
parents: 6600
diff changeset
  9268
    "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
  9269
     especially to the #accepts: and #handles: messages"
5ffa1ce7b2cc #isExceptionCreator instead of #isSignal
Stefan Vogel <sv@exept.de>
parents: 6600
diff changeset
  9270
5ffa1ce7b2cc #isExceptionCreator instead of #isSignal
Stefan Vogel <sv@exept.de>
parents: 6600
diff changeset
  9271
    ^ false
5ffa1ce7b2cc #isExceptionCreator instead of #isSignal
Stefan Vogel <sv@exept.de>
parents: 6600
diff changeset
  9272
!
5ffa1ce7b2cc #isExceptionCreator instead of #isSignal
Stefan Vogel <sv@exept.de>
parents: 6600
diff changeset
  9273
13187
f79a83bcc243 added: #isExternalAddress
Claus Gittinger <cg@exept.de>
parents: 13165
diff changeset
  9274
isExternalAddress
f79a83bcc243 added: #isExternalAddress
Claus Gittinger <cg@exept.de>
parents: 13165
diff changeset
  9275
    "return true, if the receiver is some kind of externalAddress;
f79a83bcc243 added: #isExternalAddress
Claus Gittinger <cg@exept.de>
parents: 13165
diff changeset
  9276
     false is returned here - the method is only redefined in ExternalAddress."
f79a83bcc243 added: #isExternalAddress
Claus Gittinger <cg@exept.de>
parents: 13165
diff changeset
  9277
f79a83bcc243 added: #isExternalAddress
Claus Gittinger <cg@exept.de>
parents: 13165
diff changeset
  9278
    ^ false
f79a83bcc243 added: #isExternalAddress
Claus Gittinger <cg@exept.de>
parents: 13165
diff changeset
  9279
f79a83bcc243 added: #isExternalAddress
Claus Gittinger <cg@exept.de>
parents: 13165
diff changeset
  9280
    "Created: / 22-12-2010 / 17:20:36 / cg"
f79a83bcc243 added: #isExternalAddress
Claus Gittinger <cg@exept.de>
parents: 13165
diff changeset
  9281
!
f79a83bcc243 added: #isExternalAddress
Claus Gittinger <cg@exept.de>
parents: 13165
diff changeset
  9282
14079
4568576f2690 added: #isExternalBytes
Stefan Vogel <sv@exept.de>
parents: 14078
diff changeset
  9283
isExternalBytes
4568576f2690 added: #isExternalBytes
Stefan Vogel <sv@exept.de>
parents: 14078
diff changeset
  9284
    ^ false
4568576f2690 added: #isExternalBytes
Stefan Vogel <sv@exept.de>
parents: 14078
diff changeset
  9285
!
4568576f2690 added: #isExternalBytes
Stefan Vogel <sv@exept.de>
parents: 14078
diff changeset
  9286
10480
9fc4dd89edb2 +isExternalLibraryFunction
fm
parents: 10460
diff changeset
  9287
isExternalLibraryFunction
9fc4dd89edb2 +isExternalLibraryFunction
fm
parents: 10460
diff changeset
  9288
    "return true, if the receiver is some kind of externalLibrary function;
9fc4dd89edb2 +isExternalLibraryFunction
fm
parents: 10460
diff changeset
  9289
     false is returned here - the method is only redefined in ExternalLibraryFunction."
9fc4dd89edb2 +isExternalLibraryFunction
fm
parents: 10460
diff changeset
  9290
9fc4dd89edb2 +isExternalLibraryFunction
fm
parents: 10460
diff changeset
  9291
    ^false
9fc4dd89edb2 +isExternalLibraryFunction
fm
parents: 10460
diff changeset
  9292
!
9fc4dd89edb2 +isExternalLibraryFunction
fm
parents: 10460
diff changeset
  9293
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9294
isExternalStream
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9295
    "return true, if the receiver is some kind of externalStream;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9296
     false is returned here - the method is only redefined in ExternalStream."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9297
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9298
    ^false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9299
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9300
19550
0341c4074b6c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19451
diff changeset
  9301
isExternalStructure
0341c4074b6c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19451
diff changeset
  9302
    ^ false
0341c4074b6c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19451
diff changeset
  9303
!
0341c4074b6c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19451
diff changeset
  9304
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9305
isFileStream
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9306
    "return true, if the receiver is some kind of fileStream;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9307
     false is returned here - the method is only redefined in FileStream."
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
    ^false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9310
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9311
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9312
isFilename
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9313
    "return true, if the receiver is some kind of filename;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9314
     false is returned here - the method is only redefined in Filename."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9315
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9316
    ^false
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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9319
isFixedPoint
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9320
    "return true, if the receiver is some kind of fixedPoint number;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9321
     false is returned here - the method is only redefined in FixedPoint."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9322
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9323
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9324
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9325
    "Created: 5.11.1996 / 19:23:04 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9326
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9327
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9328
isFixedSize
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  9329
    "return true if the receiver cannot grow easily
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9330
     (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
  9331
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9332
    ^ true
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9333
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9334
6185
2029fdbadfde +isFloat
Claus Gittinger <cg@exept.de>
parents: 6182
diff changeset
  9335
isFloat
2029fdbadfde +isFloat
Claus Gittinger <cg@exept.de>
parents: 6182
diff changeset
  9336
    "return true, if the receiver is some kind of floating point number;
2029fdbadfde +isFloat
Claus Gittinger <cg@exept.de>
parents: 6182
diff changeset
  9337
     false is returned here.
2029fdbadfde +isFloat
Claus Gittinger <cg@exept.de>
parents: 6182
diff changeset
  9338
     Same as #isLimitedPrecisionReal, but a better name ;-)"
2029fdbadfde +isFloat
Claus Gittinger <cg@exept.de>
parents: 6182
diff changeset
  9339
2029fdbadfde +isFloat
Claus Gittinger <cg@exept.de>
parents: 6182
diff changeset
  9340
    ^ false
2029fdbadfde +isFloat
Claus Gittinger <cg@exept.de>
parents: 6182
diff changeset
  9341
2029fdbadfde +isFloat
Claus Gittinger <cg@exept.de>
parents: 6182
diff changeset
  9342
    "Modified: / 14.11.2001 / 14:57:46 / cg"
2029fdbadfde +isFloat
Claus Gittinger <cg@exept.de>
parents: 6182
diff changeset
  9343
!
2029fdbadfde +isFloat
Claus Gittinger <cg@exept.de>
parents: 6182
diff changeset
  9344
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9345
isForm
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9346
    "return true, if the receiver is some kind of form;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9347
     false is returned here - the method is only redefined in Form."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9348
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9349
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9350
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9351
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9352
isFraction
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9353
    "return true, if the receiver is some kind of fraction;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9354
     false is returned here - the method is only redefined in Fraction."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9355
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9356
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9357
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9358
9293
307bb63a9057 category change
Claus Gittinger <cg@exept.de>
parents: 9279
diff changeset
  9359
isHierarchicalItem
307bb63a9057 category change
Claus Gittinger <cg@exept.de>
parents: 9279
diff changeset
  9360
    "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
  9361
307bb63a9057 category change
Claus Gittinger <cg@exept.de>
parents: 9279
diff changeset
  9362
    ^ false
307bb63a9057 category change
Claus Gittinger <cg@exept.de>
parents: 9279
diff changeset
  9363
!
307bb63a9057 category change
Claus Gittinger <cg@exept.de>
parents: 9279
diff changeset
  9364
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9365
isImage
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9366
    "return true, if the receiver is some kind of image;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9367
     false is returned here - the method is only redefined in Image."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9368
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9369
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9370
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9371
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9372
isImageOrForm
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9373
    "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
  9374
     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
  9375
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9376
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9377
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9378
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9379
isImmediate
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9380
    "return true if I am an immediate object
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9381
     i.e. I am represented in the pointer itself and
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9382
     no real object header/storage is used me.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9383
     (currently, only SmallIntegers, some characters and nil return true)"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9384
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9385
    ^ self class hasImmediateInstances
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9386
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9387
    "Created: 3.6.1997 / 12:00:18 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9388
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9389
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9390
isInteger
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9391
    "return true, if the receiver is some kind of integer number;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9392
     false is returned here - the method is only redefined in Integer."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9393
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9394
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9395
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9396
9279
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  9397
isInterestConverter
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  9398
    "return true if I am a kind of interest forwarder"
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  9399
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  9400
    ^ false
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  9401
!
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  9402
10576
60526e4a6854 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10567
diff changeset
  9403
isInternalByteStream
60526e4a6854 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10567
diff changeset
  9404
    "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
  9405
     false is returned here - the method is only redefined in PeekableStream."
60526e4a6854 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10567
diff changeset
  9406
60526e4a6854 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10567
diff changeset
  9407
    ^false
60526e4a6854 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10567
diff changeset
  9408
60526e4a6854 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10567
diff changeset
  9409
    "Created: / 30-05-2007 / 16:15:33 / cg"
60526e4a6854 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10567
diff changeset
  9410
!
60526e4a6854 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10567
diff changeset
  9411
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9412
isJavaClass
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9413
    "return true, if this is a javaClass.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9414
     false is returned here - the method is only redefined in JavaClass."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9415
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9416
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9417
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9418
    "Created: / 26.3.1997 / 13:34:54 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9419
    "Modified: / 8.5.1998 / 21:25:21 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9420
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9421
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9422
isJavaClassRef
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9423
    "return true, if this is a JavaClassRef.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9424
     false is returned here - the method is only redefined in JavaClassRef."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9425
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9426
    ^ false
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
    "Modified: / 8.5.1998 / 21:25:46 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9429
    "Created: / 24.12.1999 / 01:46:28 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9430
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9431
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9432
isJavaContext
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9433
    "return true, if this is a javaContext.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9434
     false is returned here - the method is only redefined in JavaContext."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9435
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9436
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9437
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9438
    "Created: / 8.5.1998 / 21:24:27 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9439
    "Modified: / 8.5.1998 / 21:25:35 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9440
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9441
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9442
isJavaMethod
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9443
    "return true, if this is a JavaMethod.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9444
     false is returned here - the method is only redefined in JavaMethod."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9445
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9446
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9447
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9448
    "Modified: / 8.5.1998 / 21:25:46 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9449
    "Created: / 25.9.1999 / 23:26:12 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9450
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9451
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9452
isJavaMethodRef
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9453
    "return true, if this is a JavaMethodRef.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9454
     false is returned here - the method is only redefined in JavaMethodRef."
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
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9457
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9458
    "Modified: / 8.5.1998 / 21:25:46 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9459
    "Created: / 23.12.1999 / 19:44:51 / cg"
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
isJavaObject
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9463
    "return true, if this is a javaObject.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9464
     false is returned here - the method is only redefined in JavaObject."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9465
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9466
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9467
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9468
    "Created: / 26.3.1997 / 13:34:48 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9469
    "Modified: / 8.5.1998 / 21:25:46 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9470
!
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
isJavaScriptClass
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9473
    "return true, if this is a javaScriptClass.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9474
     false is returned here - the method is only redefined in JavaScriptClass."
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
    ^ false
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
8935
f770c55ba40e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8934
diff changeset
  9479
isJavaScriptMetaclass
f770c55ba40e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8934
diff changeset
  9480
    "return true, if this is a javaScript Metaclass.
f770c55ba40e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8934
diff changeset
  9481
     false is returned here - the method is only redefined in JavaScriptMetaclass."
f770c55ba40e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8934
diff changeset
  9482
f770c55ba40e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8934
diff changeset
  9483
    ^ false
f770c55ba40e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8934
diff changeset
  9484
!
f770c55ba40e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8934
diff changeset
  9485
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9486
isKindOf:aClass
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9487
    "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
  9488
     subclasses, false otherwise.
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  9489
     Advice:
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  9490
        use of this to check objects for certain attributes/protocol should
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  9491
        be avoided; it limits the reusability of your classes by limiting use
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  9492
        to instances of certain classes and fences you into a specific inheritance
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  9493
        hierarchy.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  9494
        Use check-methods to check an object for a certain attributes/protocol
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  9495
        (such as #isXXXX, #respondsTo: or #isNumber).
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  9496
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  9497
        Using #isKindOf: is considered BAD STYLE.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9498
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9499
     Advice2:
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  9500
        Be aware, that using an #isXXX method is usually much faster than
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  9501
        using #isKindOf:; because isKindOf: has to walk up all the superclass
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  9502
        hierarchy, comparing every class on the way.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  9503
        Due to caching in the VM, a call to #isXXX is normally reached via
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  9504
        a single function call.
5755
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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9507
%{  /* NOCONTEXT */
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9508
    register OBJ thisClass;
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
    thisClass = __Class(self);
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9511
    while (thisClass != nil) {
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  9512
        if (thisClass == aClass) {
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  9513
            RETURN ( true );
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  9514
        }
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  9515
        thisClass = __ClassInstPtr(thisClass)->c_superclass;
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9516
    }
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9517
    RETURN ( false );
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9518
%}
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9519
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9520
"/
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9521
"/  the above code is equivalent to:
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
"/  thisClass := self class.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9524
"/  [thisClass notNil] whileTrue:[
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9525
"/      thisClass == aClass ifTrue:[^ true].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9526
"/      thisClass := thisClass superclass
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9527
"/  ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9528
"/  ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9529
"/
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9530
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9531
17168
1a65336dec3e class: Object
Claus Gittinger <cg@exept.de>
parents: 16907
diff changeset
  9532
isLabelAndIcon
1a65336dec3e class: Object
Claus Gittinger <cg@exept.de>
parents: 16907
diff changeset
  9533
    "return true, if the receiver is a labelAndIcon;
1a65336dec3e class: Object
Claus Gittinger <cg@exept.de>
parents: 16907
diff changeset
  9534
     false is returned here - the method is only redefined in LabelAndIcon."
1a65336dec3e class: Object
Claus Gittinger <cg@exept.de>
parents: 16907
diff changeset
  9535
1a65336dec3e class: Object
Claus Gittinger <cg@exept.de>
parents: 16907
diff changeset
  9536
    ^ false
1a65336dec3e class: Object
Claus Gittinger <cg@exept.de>
parents: 16907
diff changeset
  9537
!
1a65336dec3e class: Object
Claus Gittinger <cg@exept.de>
parents: 16907
diff changeset
  9538
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9539
isLayout
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9540
    "return true, if the receiver is some kind of layout;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9541
     false is returned here - the method is only redefined in Layout."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9542
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9543
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9544
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9545
6567
cba5c3103600 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6549
diff changeset
  9546
isLazyValue
cba5c3103600 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6549
diff changeset
  9547
    ^ false
cba5c3103600 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6549
diff changeset
  9548
!
cba5c3103600 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6549
diff changeset
  9549
6086
0bd476397581 added isLimitedPrecisionReal
Claus Gittinger <cg@exept.de>
parents: 6074
diff changeset
  9550
isLimitedPrecisionReal
0bd476397581 added isLimitedPrecisionReal
Claus Gittinger <cg@exept.de>
parents: 6074
diff changeset
  9551
    "return true, if the receiver is some kind of floating point number;
0bd476397581 added isLimitedPrecisionReal
Claus Gittinger <cg@exept.de>
parents: 6074
diff changeset
  9552
     false is returned here - the method is only redefined in LimitedPrecisionReal."
0bd476397581 added isLimitedPrecisionReal
Claus Gittinger <cg@exept.de>
parents: 6074
diff changeset
  9553
0bd476397581 added isLimitedPrecisionReal
Claus Gittinger <cg@exept.de>
parents: 6074
diff changeset
  9554
    ^ false
0bd476397581 added isLimitedPrecisionReal
Claus Gittinger <cg@exept.de>
parents: 6074
diff changeset
  9555
!
0bd476397581 added isLimitedPrecisionReal
Claus Gittinger <cg@exept.de>
parents: 6074
diff changeset
  9556
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9557
isList
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9558
    "return true, if the receiver is some kind of list collection;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9559
     false is returned here - the method is only redefined in List."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9560
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9561
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9562
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9563
    "Created: / 11.2.2000 / 01:37:05 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9564
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9565
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9566
isLiteral
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9567
    "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
  9568
     false is returned here - the method is redefined in some classes."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9569
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9570
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9571
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9572
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9573
isMemberOf:aClass
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9574
    "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
  9575
     Advice:
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  9576
        use of this to check objects for certain attributes/protocol should
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  9577
        be avoided; it limits the reusability of your classes by limiting use
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  9578
        to instances of a certain class.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  9579
        Use check-methods to check an object for a certain attributes/protocol
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  9580
        (such as #isXXX, #respondsTo: or #isNumber);
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  9581
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  9582
        Using #isMemberOf: is considered BAD STYLE.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9583
     Notice:
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  9584
        This method is open coded (inlined) by the compiler(s)
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  9585
        - redefining it may not work as expected."
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9586
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9587
    ^ (self class) == aClass
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9588
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9589
18319
a28d1c9dd31e class: Object
Claus Gittinger <cg@exept.de>
parents: 18289
diff changeset
  9590
isMenuItem
a28d1c9dd31e class: Object
Claus Gittinger <cg@exept.de>
parents: 18289
diff changeset
  9591
    "return true, if the receiver is a menu item inside a MenuPanel, Menu or PopUpmenu.
a28d1c9dd31e class: Object
Claus Gittinger <cg@exept.de>
parents: 18289
diff changeset
  9592
     false is returned here - the method is redefined in some classes."
a28d1c9dd31e class: Object
Claus Gittinger <cg@exept.de>
parents: 18289
diff changeset
  9593
a28d1c9dd31e class: Object
Claus Gittinger <cg@exept.de>
parents: 18289
diff changeset
  9594
    ^ false
a28d1c9dd31e class: Object
Claus Gittinger <cg@exept.de>
parents: 18289
diff changeset
  9595
!
a28d1c9dd31e class: Object
Claus Gittinger <cg@exept.de>
parents: 18289
diff changeset
  9596
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9597
isMeta
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9598
    "return true, if the receiver is some kind of metaclass;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9599
     false is returned here - the method is only redefined in Metaclass."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9600
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9601
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9602
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9603
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9604
isMethod
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9605
    "return true, if the receiver is some kind of method;
16021
301a3939838f class: Object
Claus Gittinger <cg@exept.de>
parents: 16012
diff changeset
  9606
     false returned here - this method is only redefined in Method."
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9607
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9608
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9609
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9610
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9611
isMorph
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9612
    "return true, if the receiver is some kind of morph;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9613
     false is returned here - the method is only redefined in Morph."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9614
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9615
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9616
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9617
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9618
isNameSpace
9221
d8fff4a78065 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9216
diff changeset
  9619
    "return true, if the receiver is a nameSpace.
d8fff4a78065 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9216
diff changeset
  9620
     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
  9621
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9622
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9623
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9624
    "Created: / 11.10.1996 / 18:08:56 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9625
    "Modified: / 8.5.1998 / 21:26:05 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9626
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9627
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9628
isNamespace
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9629
    "return true, if this is a nameSpace.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9630
     false is returned here - the method is only redefined in Namespace."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9631
5869
362be80efcb9 Use <resource:#obsolete>
Stefan Vogel <sv@exept.de>
parents: 5856
diff changeset
  9632
    <resource:#obsolete>
362be80efcb9 Use <resource:#obsolete>
Stefan Vogel <sv@exept.de>
parents: 5856
diff changeset
  9633
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9634
    self obsoleteMethodWarning:'use #isNameSpace'.
6805
f95ad1a82775 *** empty log message ***
ca
parents: 6800
diff changeset
  9635
    ^ self isNameSpace
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9636
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9637
6068
1d5ca1175f3f added #isNilOrEmptyCollection
Claus Gittinger <cg@exept.de>
parents: 6033
diff changeset
  9638
isNil
9221
d8fff4a78065 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9216
diff changeset
  9639
    "Return true, if the receiver is nil.
d8fff4a78065 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9216
diff changeset
  9640
     Because isNil is redefined in UndefinedObject,
d8fff4a78065 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9216
diff changeset
  9641
     the receiver is definitely not nil here, so unconditionally return false.
6068
1d5ca1175f3f added #isNilOrEmptyCollection
Claus Gittinger <cg@exept.de>
parents: 6033
diff changeset
  9642
     Notice:
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  9643
        This method is open coded (inlined) by the compiler(s)
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  9644
        - redefining it may not work as expected."
6068
1d5ca1175f3f added #isNilOrEmptyCollection
Claus Gittinger <cg@exept.de>
parents: 6033
diff changeset
  9645
1d5ca1175f3f added #isNilOrEmptyCollection
Claus Gittinger <cg@exept.de>
parents: 6033
diff changeset
  9646
    ^ false
1d5ca1175f3f added #isNilOrEmptyCollection
Claus Gittinger <cg@exept.de>
parents: 6033
diff changeset
  9647
!
1d5ca1175f3f added #isNilOrEmptyCollection
Claus Gittinger <cg@exept.de>
parents: 6033
diff changeset
  9648
1d5ca1175f3f added #isNilOrEmptyCollection
Claus Gittinger <cg@exept.de>
parents: 6033
diff changeset
  9649
isNilOrEmptyCollection
6182
2b992cf865bc comment
Claus Gittinger <cg@exept.de>
parents: 6181
diff changeset
  9650
    "return true if I am nil or an empty collection - false here.
8833
717b01292d0e comments
Stefan Vogel <sv@exept.de>
parents: 8832
diff changeset
  9651
     Obsolete, use isEmptyOrNil."
717b01292d0e comments
Stefan Vogel <sv@exept.de>
parents: 8832
diff changeset
  9652
717b01292d0e comments
Stefan Vogel <sv@exept.de>
parents: 8832
diff changeset
  9653
    <resource:#obsolete>
6068
1d5ca1175f3f added #isNilOrEmptyCollection
Claus Gittinger <cg@exept.de>
parents: 6033
diff changeset
  9654
1d5ca1175f3f added #isNilOrEmptyCollection
Claus Gittinger <cg@exept.de>
parents: 6033
diff changeset
  9655
    ^ false
6182
2b992cf865bc comment
Claus Gittinger <cg@exept.de>
parents: 6181
diff changeset
  9656
2b992cf865bc comment
Claus Gittinger <cg@exept.de>
parents: 6181
diff changeset
  9657
    "Modified: / 13.11.2001 / 13:28:06 / cg"
6068
1d5ca1175f3f added #isNilOrEmptyCollection
Claus Gittinger <cg@exept.de>
parents: 6033
diff changeset
  9658
!
1d5ca1175f3f added #isNilOrEmptyCollection
Claus Gittinger <cg@exept.de>
parents: 6033
diff changeset
  9659
9005
b82aa6bdc487 #isNonByteCollection
Stefan Vogel <sv@exept.de>
parents: 8986
diff changeset
  9660
isNonByteCollection
b82aa6bdc487 #isNonByteCollection
Stefan Vogel <sv@exept.de>
parents: 8986
diff changeset
  9661
    "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
  9662
     false is returned here - the method is redefined in Collection and UninterpretedBytes."
b82aa6bdc487 #isNonByteCollection
Stefan Vogel <sv@exept.de>
parents: 8986
diff changeset
  9663
b82aa6bdc487 #isNonByteCollection
Stefan Vogel <sv@exept.de>
parents: 8986
diff changeset
  9664
    ^ false
b82aa6bdc487 #isNonByteCollection
Stefan Vogel <sv@exept.de>
parents: 8986
diff changeset
  9665
b82aa6bdc487 #isNonByteCollection
Stefan Vogel <sv@exept.de>
parents: 8986
diff changeset
  9666
    "
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  9667
        21 isNonByteCollection
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  9668
        'abc' isNonByteCollection
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  9669
        #'abc' isNonByteCollection
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  9670
        #[1 2 3] isNonByteCollection
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  9671
        #(1 2 3) isNonByteCollection
9005
b82aa6bdc487 #isNonByteCollection
Stefan Vogel <sv@exept.de>
parents: 8986
diff changeset
  9672
    "
b82aa6bdc487 #isNonByteCollection
Stefan Vogel <sv@exept.de>
parents: 8986
diff changeset
  9673
!
b82aa6bdc487 #isNonByteCollection
Stefan Vogel <sv@exept.de>
parents: 8986
diff changeset
  9674
16907
402df2d3c1d7 added: Object>>isNotNil
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16828
diff changeset
  9675
isNotNil
19781
810b4dd98ddd #REFACTORING by mawalch
mawalch
parents: 19719
diff changeset
  9676
    <resource: #obsolete>
810b4dd98ddd #REFACTORING by mawalch
mawalch
parents: 19719
diff changeset
  9677
16907
402df2d3c1d7 added: Object>>isNotNil
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16828
diff changeset
  9678
    "Return true, if the receiver not nil.
402df2d3c1d7 added: Object>>isNotNil
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16828
diff changeset
  9679
     Because isNotNil is redefined in UndefinedObject,
402df2d3c1d7 added: Object>>isNotNil
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16828
diff changeset
  9680
     the receiver is definitely not nil here, so unconditionally return true."
402df2d3c1d7 added: Object>>isNotNil
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16828
diff changeset
  9681
19781
810b4dd98ddd #REFACTORING by mawalch
mawalch
parents: 19719
diff changeset
  9682
    self obsoleteMethodWarning:'use #notNil'.
16907
402df2d3c1d7 added: Object>>isNotNil
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16828
diff changeset
  9683
    ^ true
402df2d3c1d7 added: Object>>isNotNil
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16828
diff changeset
  9684
402df2d3c1d7 added: Object>>isNotNil
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16828
diff changeset
  9685
    "Created: / 26-10-2014 / 01:30:15 / Jan Vrany <jan.vrany@fit.cvut.cz>"
402df2d3c1d7 added: Object>>isNotNil
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16828
diff changeset
  9686
!
402df2d3c1d7 added: Object>>isNotNil
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16828
diff changeset
  9687
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9688
isNumber
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9689
    "return true, if the receiver is some kind of number;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9690
     false is returned here - the method is only redefined in Number."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9691
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9692
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9693
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9694
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9695
isOrderedCollection
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9696
    "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
  9697
     false is returned here - the method is only redefined in OrderedCollection."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9698
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9699
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9700
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9701
16342
d0f27ca59145 class: Object
Stefan Vogel <sv@exept.de>
parents: 16325
diff changeset
  9702
isOsHandle
d0f27ca59145 class: Object
Stefan Vogel <sv@exept.de>
parents: 16325
diff changeset
  9703
    ^ false
d0f27ca59145 class: Object
Stefan Vogel <sv@exept.de>
parents: 16325
diff changeset
  9704
!
d0f27ca59145 class: Object
Stefan Vogel <sv@exept.de>
parents: 16325
diff changeset
  9705
18894
ff31342f584a #FEATURE
Stefan Vogel <sv@exept.de>
parents: 18802
diff changeset
  9706
isPlainString
ff31342f584a #FEATURE
Stefan Vogel <sv@exept.de>
parents: 18802
diff changeset
  9707
    "return true, if the receiver is a plain string - without attributes;
ff31342f584a #FEATURE
Stefan Vogel <sv@exept.de>
parents: 18802
diff changeset
  9708
     false is returned here - the method is redefined in CharacterArray and Text."
ff31342f584a #FEATURE
Stefan Vogel <sv@exept.de>
parents: 18802
diff changeset
  9709
ff31342f584a #FEATURE
Stefan Vogel <sv@exept.de>
parents: 18802
diff changeset
  9710
    ^ false
ff31342f584a #FEATURE
Stefan Vogel <sv@exept.de>
parents: 18802
diff changeset
  9711
!
ff31342f584a #FEATURE
Stefan Vogel <sv@exept.de>
parents: 18802
diff changeset
  9712
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9713
isPoint
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9714
    "return true, if the receiver is some kind of point;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9715
     false is returned here - the method is only redefined in Point."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9716
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9717
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9718
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9719
10532
36237807e16a + #isPrinterContext
fm
parents: 10530
diff changeset
  9720
isPrinterContext
36237807e16a + #isPrinterContext
fm
parents: 10530
diff changeset
  9721
36237807e16a + #isPrinterContext
fm
parents: 10530
diff changeset
  9722
    ^false
36237807e16a + #isPrinterContext
fm
parents: 10530
diff changeset
  9723
!
36237807e16a + #isPrinterContext
fm
parents: 10530
diff changeset
  9724
13416
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  9725
isProgrammingLanguage
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  9726
    "return true, if the receiver is a programming language.
14632
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14539
diff changeset
  9727
     False is returned here - the method is only redefined in
13416
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  9728
     ProgrammingLanguage."
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  9729
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  9730
    ^ false
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  9731
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  9732
    "Created: / 21-07-2010 / 15:13:50 / Jan Vrany <jan.vrany@fit.cvut.cz>"
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  9733
!
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  9734
9515
89c8275e009a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9509
diff changeset
  9735
isProjectDefinition
89c8275e009a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9509
diff changeset
  9736
    "return true, if the receiver is a projectDefinition.
89c8275e009a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9509
diff changeset
  9737
     False is returned here - the method is only redefined in ProjectDefinition."
89c8275e009a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9509
diff changeset
  9738
89c8275e009a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9509
diff changeset
  9739
    ^ false
89c8275e009a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9509
diff changeset
  9740
89c8275e009a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9509
diff changeset
  9741
    "Created: / 10-08-2006 / 16:24:53 / cg"
89c8275e009a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9509
diff changeset
  9742
!
89c8275e009a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9509
diff changeset
  9743
13140
919308f42885 added: #isProxy
Claus Gittinger <cg@exept.de>
parents: 13136
diff changeset
  9744
isProxy
919308f42885 added: #isProxy
Claus Gittinger <cg@exept.de>
parents: 13136
diff changeset
  9745
    "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
  9746
     False is returned here."
919308f42885 added: #isProxy
Claus Gittinger <cg@exept.de>
parents: 13136
diff changeset
  9747
919308f42885 added: #isProxy
Claus Gittinger <cg@exept.de>
parents: 13136
diff changeset
  9748
    ^ false
919308f42885 added: #isProxy
Claus Gittinger <cg@exept.de>
parents: 13136
diff changeset
  9749
919308f42885 added: #isProxy
Claus Gittinger <cg@exept.de>
parents: 13136
diff changeset
  9750
    "Created: / 21-11-2010 / 11:15:46 / cg"
919308f42885 added: #isProxy
Claus Gittinger <cg@exept.de>
parents: 13136
diff changeset
  9751
!
919308f42885 added: #isProxy
Claus Gittinger <cg@exept.de>
parents: 13136
diff changeset
  9752
10171
523c654f762b +isRealNameSpace
Claus Gittinger <cg@exept.de>
parents: 10062
diff changeset
  9753
isRealNameSpace
15439
6e30547e7c1d class: Object
Claus Gittinger <cg@exept.de>
parents: 15407
diff changeset
  9754
    "return true, if the receiver is a nameSpace, but not Smalltalk (which is also a class).
6e30547e7c1d class: Object
Claus Gittinger <cg@exept.de>
parents: 15407
diff changeset
  9755
     False is returned here - the method is redefined in Namespace and Smalltalk."
10171
523c654f762b +isRealNameSpace
Claus Gittinger <cg@exept.de>
parents: 10062
diff changeset
  9756
523c654f762b +isRealNameSpace
Claus Gittinger <cg@exept.de>
parents: 10062
diff changeset
  9757
    ^ false
523c654f762b +isRealNameSpace
Claus Gittinger <cg@exept.de>
parents: 10062
diff changeset
  9758
523c654f762b +isRealNameSpace
Claus Gittinger <cg@exept.de>
parents: 10062
diff changeset
  9759
    "Created: / 10-11-2006 / 17:05:43 / cg"
523c654f762b +isRealNameSpace
Claus Gittinger <cg@exept.de>
parents: 10062
diff changeset
  9760
!
523c654f762b +isRealNameSpace
Claus Gittinger <cg@exept.de>
parents: 10062
diff changeset
  9761
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9762
isRectangle
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9763
    "return true, if the receiver is some kind of rectangle;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9764
     false is returned here - the method is only redefined in Rectangle."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9765
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9766
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9767
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9768
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9769
isRemoteObject
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9770
    "return true, if the receiver is some kind of remoteObject,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9771
     false if its local - the method is only redefined in RemoteObject."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9772
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9773
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9774
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9775
    "Created: 28.10.1996 / 15:18:45 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9776
    "Modified: 28.10.1996 / 15:20:57 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9777
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9778
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9779
isSequenceable
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9780
    "return true, if the receiver is some kind of sequenceable collection;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9781
     false is returned here - the method is only redefined in SequenceableCollection."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9782
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9783
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9784
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9785
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9786
isSequenceableCollection
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9787
    "OBSOLETE: use isSequenceable for ST-80 compatibility.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9788
     This method is a historic leftover and will be removed soon ...
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9789
     (although its name is much better than #isSequenceable - sigh)"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9790
5869
362be80efcb9 Use <resource:#obsolete>
Stefan Vogel <sv@exept.de>
parents: 5856
diff changeset
  9791
    <resource:#obsolete>
362be80efcb9 Use <resource:#obsolete>
Stefan Vogel <sv@exept.de>
parents: 5856
diff changeset
  9792
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9793
    self obsoleteMethodWarning:'use #isSequenceable'.
17365
b3c64ee9cbf5 class: Object
Claus Gittinger <cg@exept.de>
parents: 17306
diff changeset
  9794
    ^ self isSequenceable
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9795
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9796
10856
d54db15b9761 +isSharedPool
Claus Gittinger <cg@exept.de>
parents: 10837
diff changeset
  9797
isSharedPool
d54db15b9761 +isSharedPool
Claus Gittinger <cg@exept.de>
parents: 10837
diff changeset
  9798
    "return true, if the receiver is a sharedPool.
d54db15b9761 +isSharedPool
Claus Gittinger <cg@exept.de>
parents: 10837
diff changeset
  9799
     False is returned here - the method is only redefined in SharedPool."
d54db15b9761 +isSharedPool
Claus Gittinger <cg@exept.de>
parents: 10837
diff changeset
  9800
d54db15b9761 +isSharedPool
Claus Gittinger <cg@exept.de>
parents: 10837
diff changeset
  9801
    ^ false
d54db15b9761 +isSharedPool
Claus Gittinger <cg@exept.de>
parents: 10837
diff changeset
  9802
!
d54db15b9761 +isSharedPool
Claus Gittinger <cg@exept.de>
parents: 10837
diff changeset
  9803
16770
9ac0b20cef5f class: Object
Claus Gittinger <cg@exept.de>
parents: 16732
diff changeset
  9804
isSingleByteString
9ac0b20cef5f class: Object
Claus Gittinger <cg@exept.de>
parents: 16732
diff changeset
  9805
    "return true, if the receiver is a string or immutableString.
16772
429a8466520a class: Object
Claus Gittinger <cg@exept.de>
parents: 16770
diff changeset
  9806
     false is returned here - the method is only redefined in String.
429a8466520a class: Object
Claus Gittinger <cg@exept.de>
parents: 16770
diff changeset
  9807
     Must replace foo isMemberOf:String and foo class == String"
16770
9ac0b20cef5f class: Object
Claus Gittinger <cg@exept.de>
parents: 16732
diff changeset
  9808
9ac0b20cef5f class: Object
Claus Gittinger <cg@exept.de>
parents: 16732
diff changeset
  9809
    ^ false
9ac0b20cef5f class: Object
Claus Gittinger <cg@exept.de>
parents: 16732
diff changeset
  9810
!
9ac0b20cef5f class: Object
Claus Gittinger <cg@exept.de>
parents: 16732
diff changeset
  9811
15514
a9a6355f89d4 class: Object
Stefan Vogel <sv@exept.de>
parents: 15501
diff changeset
  9812
isSocketAddress
a9a6355f89d4 class: Object
Stefan Vogel <sv@exept.de>
parents: 15501
diff changeset
  9813
    ^ false
a9a6355f89d4 class: Object
Stefan Vogel <sv@exept.de>
parents: 15501
diff changeset
  9814
!
a9a6355f89d4 class: Object
Stefan Vogel <sv@exept.de>
parents: 15501
diff changeset
  9815
13565
4c0a9ea3a4e1 added: #isSpecialInstrumentationInfoLiteral
Claus Gittinger <cg@exept.de>
parents: 13515
diff changeset
  9816
isSpecialInstrumentationInfoLiteral
4c0a9ea3a4e1 added: #isSpecialInstrumentationInfoLiteral
Claus Gittinger <cg@exept.de>
parents: 13515
diff changeset
  9817
    "return true, if the receiver is a special instrumentation info
4c0a9ea3a4e1 added: #isSpecialInstrumentationInfoLiteral
Claus Gittinger <cg@exept.de>
parents: 13515
diff changeset
  9818
     object as placed into the literal array of instrumented methods"
4c0a9ea3a4e1 added: #isSpecialInstrumentationInfoLiteral
Claus Gittinger <cg@exept.de>
parents: 13515
diff changeset
  9819
4c0a9ea3a4e1 added: #isSpecialInstrumentationInfoLiteral
Claus Gittinger <cg@exept.de>
parents: 13515
diff changeset
  9820
    ^ false
4c0a9ea3a4e1 added: #isSpecialInstrumentationInfoLiteral
Claus Gittinger <cg@exept.de>
parents: 13515
diff changeset
  9821
4c0a9ea3a4e1 added: #isSpecialInstrumentationInfoLiteral
Claus Gittinger <cg@exept.de>
parents: 13515
diff changeset
  9822
    "Created: / 07-08-2011 / 17:03:41 / cg"
4c0a9ea3a4e1 added: #isSpecialInstrumentationInfoLiteral
Claus Gittinger <cg@exept.de>
parents: 13515
diff changeset
  9823
!
4c0a9ea3a4e1 added: #isSpecialInstrumentationInfoLiteral
Claus Gittinger <cg@exept.de>
parents: 13515
diff changeset
  9824
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9825
isStream
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9826
    "return true, if the receiver is some kind of stream;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9827
     false is returned here - the method is only redefined in Stream."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9828
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9829
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9830
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9831
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9832
isString
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9833
    "return true, if the receiver is some kind of string;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9834
     false is returned here - the method is only redefined in CharacterArray."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9835
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9836
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9837
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9838
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9839
isStringCollection
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9840
    "return true, if the receiver is some kind of stringCollection;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9841
     false is returned here - the method is only redefined in StringCollection."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9842
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9843
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9844
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9845
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9846
isSymbol
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9847
    "return true, if the receiver is some kind of symbol;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9848
     false is returned here - the method is only redefined in Symbol."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9849
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9850
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9851
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9852
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9853
isText
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9854
    "return true, if the receiver is some kind of text object;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9855
     false is returned here - the method is only redefined in Text."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9856
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9857
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9858
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9859
    "Created: 12.5.1996 / 10:56:50 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9860
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9861
13656
46e673aac938 added: #isTextView
Claus Gittinger <cg@exept.de>
parents: 13626
diff changeset
  9862
isTextView
46e673aac938 added: #isTextView
Claus Gittinger <cg@exept.de>
parents: 13626
diff changeset
  9863
    "return true, if the receiver is some kind of textView;
46e673aac938 added: #isTextView
Claus Gittinger <cg@exept.de>
parents: 13626
diff changeset
  9864
     false is returned here - the method is only redefined in TextViews."
46e673aac938 added: #isTextView
Claus Gittinger <cg@exept.de>
parents: 13626
diff changeset
  9865
46e673aac938 added: #isTextView
Claus Gittinger <cg@exept.de>
parents: 13626
diff changeset
  9866
    ^ false
46e673aac938 added: #isTextView
Claus Gittinger <cg@exept.de>
parents: 13626
diff changeset
  9867
46e673aac938 added: #isTextView
Claus Gittinger <cg@exept.de>
parents: 13626
diff changeset
  9868
    "Modified (comment): / 08-09-2011 / 05:12:37 / cg"
46e673aac938 added: #isTextView
Claus Gittinger <cg@exept.de>
parents: 13626
diff changeset
  9869
!
46e673aac938 added: #isTextView
Claus Gittinger <cg@exept.de>
parents: 13626
diff changeset
  9870
16349
ef173d25b20c class: Object
Claus Gittinger <cg@exept.de>
parents: 16342
diff changeset
  9871
isTimeDuration
ef173d25b20c class: Object
Claus Gittinger <cg@exept.de>
parents: 16342
diff changeset
  9872
    "return true, if the receiver is some kind of time duration;
ef173d25b20c class: Object
Claus Gittinger <cg@exept.de>
parents: 16342
diff changeset
  9873
     false is returned here - the method is only redefined in TimeDuration."
ef173d25b20c class: Object
Claus Gittinger <cg@exept.de>
parents: 16342
diff changeset
  9874
ef173d25b20c class: Object
Claus Gittinger <cg@exept.de>
parents: 16342
diff changeset
  9875
    ^ false
ef173d25b20c class: Object
Claus Gittinger <cg@exept.de>
parents: 16342
diff changeset
  9876
!
ef173d25b20c class: Object
Claus Gittinger <cg@exept.de>
parents: 16342
diff changeset
  9877
13229
187ab17bc43d added: #isTimestamp
Stefan Vogel <sv@exept.de>
parents: 13190
diff changeset
  9878
isTimestamp
16349
ef173d25b20c class: Object
Claus Gittinger <cg@exept.de>
parents: 16342
diff changeset
  9879
    "return true, if the receiver is some kind of time duration;
ef173d25b20c class: Object
Claus Gittinger <cg@exept.de>
parents: 16342
diff changeset
  9880
     false is returned here - the method is only redefined in Timestamp."
ef173d25b20c class: Object
Claus Gittinger <cg@exept.de>
parents: 16342
diff changeset
  9881
13229
187ab17bc43d added: #isTimestamp
Stefan Vogel <sv@exept.de>
parents: 13190
diff changeset
  9882
    ^ false
187ab17bc43d added: #isTimestamp
Stefan Vogel <sv@exept.de>
parents: 13190
diff changeset
  9883
!
187ab17bc43d added: #isTimestamp
Stefan Vogel <sv@exept.de>
parents: 13190
diff changeset
  9884
13626
057aa930d735 added: #isTrait
Claus Gittinger <cg@exept.de>
parents: 13578
diff changeset
  9885
isTrait
057aa930d735 added: #isTrait
Claus Gittinger <cg@exept.de>
parents: 13578
diff changeset
  9886
    "Return true if the receiver is a trait.
057aa930d735 added: #isTrait
Claus Gittinger <cg@exept.de>
parents: 13578
diff changeset
  9887
     Note: Do not override in any class except TraitBehavior."
057aa930d735 added: #isTrait
Claus Gittinger <cg@exept.de>
parents: 13578
diff changeset
  9888
057aa930d735 added: #isTrait
Claus Gittinger <cg@exept.de>
parents: 13578
diff changeset
  9889
    ^ false
057aa930d735 added: #isTrait
Claus Gittinger <cg@exept.de>
parents: 13578
diff changeset
  9890
057aa930d735 added: #isTrait
Claus Gittinger <cg@exept.de>
parents: 13578
diff changeset
  9891
    "Created: / 04-09-2011 / 20:04:43 / cg"
057aa930d735 added: #isTrait
Claus Gittinger <cg@exept.de>
parents: 13578
diff changeset
  9892
!
057aa930d735 added: #isTrait
Claus Gittinger <cg@exept.de>
parents: 13578
diff changeset
  9893
14296
fe82bc5091f9 added: #isUUID
Stefan Vogel <sv@exept.de>
parents: 14292
diff changeset
  9894
isUUID
16349
ef173d25b20c class: Object
Claus Gittinger <cg@exept.de>
parents: 16342
diff changeset
  9895
    "Return true if the receiver is a uuid.
ef173d25b20c class: Object
Claus Gittinger <cg@exept.de>
parents: 16342
diff changeset
  9896
     Note: Do not override in any class except UUID."
ef173d25b20c class: Object
Claus Gittinger <cg@exept.de>
parents: 16342
diff changeset
  9897
14296
fe82bc5091f9 added: #isUUID
Stefan Vogel <sv@exept.de>
parents: 14292
diff changeset
  9898
    ^ false
fe82bc5091f9 added: #isUUID
Stefan Vogel <sv@exept.de>
parents: 14292
diff changeset
  9899
!
fe82bc5091f9 added: #isUUID
Stefan Vogel <sv@exept.de>
parents: 14292
diff changeset
  9900
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9901
isValueModel
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9902
    "return true, if the receiver is some kind of valueModel;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9903
     false is returned here - the method is only redefined in ValueModel."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9904
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9905
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9906
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9907
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9908
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9909
isVariable
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9910
    "return true if the receiver has indexed instance variables,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9911
     false otherwise."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9912
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9913
    ^ self class isVariable
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9914
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9915
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9916
isVariableBinding
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9917
    "return true, if this is a binding for a variable.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9918
     false is returned here - the method is only redefined in Binding."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9919
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9920
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9921
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9922
    "Created: / 19.6.1997 / 17:38:44 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9923
    "Modified: / 8.5.1998 / 21:26:55 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9924
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9925
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9926
isView
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9927
    "return true, if the receiver is some kind of view;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9928
     false is returned here - the method is only redefined in View."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9929
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9930
    ^ false
6068
1d5ca1175f3f added #isNilOrEmptyCollection
Claus Gittinger <cg@exept.de>
parents: 6033
diff changeset
  9931
!
1d5ca1175f3f added #isNilOrEmptyCollection
Claus Gittinger <cg@exept.de>
parents: 6033
diff changeset
  9932
15943
e232d88d7157 class: Object
Claus Gittinger <cg@exept.de>
parents: 15942
diff changeset
  9933
isViewBackground
e232d88d7157 class: Object
Claus Gittinger <cg@exept.de>
parents: 15942
diff changeset
  9934
    "return false here; to be redefined in subclass(es)"
e232d88d7157 class: Object
Claus Gittinger <cg@exept.de>
parents: 15942
diff changeset
  9935
e232d88d7157 class: Object
Claus Gittinger <cg@exept.de>
parents: 15942
diff changeset
  9936
    ^ false
e232d88d7157 class: Object
Claus Gittinger <cg@exept.de>
parents: 15942
diff changeset
  9937
!
e232d88d7157 class: Object
Claus Gittinger <cg@exept.de>
parents: 15942
diff changeset
  9938
18802
8966fcaa112d #BUGFIX
Stefan Vogel <sv@exept.de>
parents: 18799
diff changeset
  9939
isWeakCollection
8966fcaa112d #BUGFIX
Stefan Vogel <sv@exept.de>
parents: 18799
diff changeset
  9940
    "return true, if the receiver has weak references to its elements."
8966fcaa112d #BUGFIX
Stefan Vogel <sv@exept.de>
parents: 18799
diff changeset
  9941
8966fcaa112d #BUGFIX
Stefan Vogel <sv@exept.de>
parents: 18799
diff changeset
  9942
    ^ false
8966fcaa112d #BUGFIX
Stefan Vogel <sv@exept.de>
parents: 18799
diff changeset
  9943
!
8966fcaa112d #BUGFIX
Stefan Vogel <sv@exept.de>
parents: 18799
diff changeset
  9944
6932
1e1d296d4747 + #notEmptyOrNil
penk
parents: 6926
diff changeset
  9945
notEmptyOrNil
1e1d296d4747 + #notEmptyOrNil
penk
parents: 6926
diff changeset
  9946
    "Squeak compatibility:
1e1d296d4747 + #notEmptyOrNil
penk
parents: 6926
diff changeset
  9947
     return true if I am neither nil nor an empty collection.
1e1d296d4747 + #notEmptyOrNil
penk
parents: 6926
diff changeset
  9948
     Return true here."
1e1d296d4747 + #notEmptyOrNil
penk
parents: 6926
diff changeset
  9949
1e1d296d4747 + #notEmptyOrNil
penk
parents: 6926
diff changeset
  9950
    ^ true
1e1d296d4747 + #notEmptyOrNil
penk
parents: 6926
diff changeset
  9951
!
1e1d296d4747 + #notEmptyOrNil
penk
parents: 6926
diff changeset
  9952
6068
1d5ca1175f3f added #isNilOrEmptyCollection
Claus Gittinger <cg@exept.de>
parents: 6033
diff changeset
  9953
notNil
9221
d8fff4a78065 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9216
diff changeset
  9954
    "Return true, if the receiver is not nil.
d8fff4a78065 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9216
diff changeset
  9955
     Because notNil is redefined in UndefinedObject,
d8fff4a78065 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9216
diff changeset
  9956
     the receiver is definitely not nil here, so unconditionally return true.
6068
1d5ca1175f3f added #isNilOrEmptyCollection
Claus Gittinger <cg@exept.de>
parents: 6033
diff changeset
  9957
     Notice:
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  9958
        This method is open coded (inlined) by the compiler(s)
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  9959
        - redefining it may not work as expected."
6068
1d5ca1175f3f added #isNilOrEmptyCollection
Claus Gittinger <cg@exept.de>
parents: 6033
diff changeset
  9960
1d5ca1175f3f added #isNilOrEmptyCollection
Claus Gittinger <cg@exept.de>
parents: 6033
diff changeset
  9961
    ^ true
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9962
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9963
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9964
!Object methodsFor:'tracing'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9965
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9966
traceInto:aRequestor level:level from:referrer
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9967
    "double dispatch into tracer, passing my type implicitely in the selector"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9968
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9969
    ^ aRequestor traceObject:self level:level from:referrer
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9970
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9971
    "Created: / 2.9.1999 / 09:05:17 / stefan"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9972
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9973
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9974
!Object methodsFor:'user interaction & notifications'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9975
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9976
activityNotification:aString
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9977
    "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
  9978
     some long-time activity.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9979
     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
  9980
     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
  9981
     and proceed. If there is no handler, this is simply ignored.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9982
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9983
     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
  9984
     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
  9985
     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
  9986
8330
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
  9987
    ActivityNotification isHandled ifTrue:[
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  9988
        ^ ActivityNotification raiseRequestWith:self errorString:aString
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9989
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9990
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9991
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9992
     nil activityNotification:'hello there'
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9993
     self activityNotification:'hello there'
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9994
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9995
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9996
    "
8330
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
  9997
     ActivityNotification handle:[:ex |
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  9998
        ex errorString printCR.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  9999
        ex proceed.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10000
     ] do:[
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
 10001
        'hello' printCR.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
 10002
        self activityNotification:'doing some long time computation'.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
 10003
        'world' printCR.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10004
     ]
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10005
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10006
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10007
    "Modified: 16.12.1995 / 18:23:42 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10008
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10009
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10010
confirm:aString
9694
64f6face84d5 comment
Claus Gittinger <cg@exept.de>
parents: 9657
diff changeset
 10011
    "open a modal yes-no dialog.
64f6face84d5 comment
Claus Gittinger <cg@exept.de>
parents: 9657
diff changeset
 10012
     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
 10013
     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
 10014
b783c0000f54 #confirm: now uses the UserConfirmation otification to request an answer
Stefan Vogel <sv@exept.de>
parents: 10480
diff changeset
 10015
     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
 10016
     by handling the UserConfirmation."
b783c0000f54 #confirm: now uses the UserConfirmation otification to request an answer
Stefan Vogel <sv@exept.de>
parents: 10480
diff changeset
 10017
b783c0000f54 #confirm: now uses the UserConfirmation otification to request an answer
Stefan Vogel <sv@exept.de>
parents: 10480
diff changeset
 10018
    ^ UserConfirmation raiseRequestErrorString:aString
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
 10019
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10020
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10021
     nil confirm:'hello'
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10022
     self confirm:'hello'
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10023
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10024
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10025
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10026
confirm:aString orCancel:cancelBlock
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10027
    "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
 10028
     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
 10029
     If no GUI is present (headless applications), cancelBlock is returned."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10030
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10031
    |answer|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10032
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10033
    answer := self confirmWithCancel:aString.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10034
    answer isNil ifTrue:[
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
 10035
        ^ cancelBlock value
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10036
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10037
    ^ answer
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
 10038
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10039
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10040
     self confirm:'hello' orCancel:[self halt]
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10041
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10042
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10043
    "Modified: 20.5.1996 / 10:28:40 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10044
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10045
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10046
confirmWithCancel:aString
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10047
    "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
 10048
     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
 10049
     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
 10050
b783c0000f54 #confirm: now uses the UserConfirmation otification to request an answer
Stefan Vogel <sv@exept.de>
parents: 10480
diff changeset
 10051
     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
 10052
     by handling the UserConfirmation."
b783c0000f54 #confirm: now uses the UserConfirmation otification to request an answer
Stefan Vogel <sv@exept.de>
parents: 10480
diff changeset
 10053
11366
97a8331d3e4c + confirmWithCancel defaultAnswer
Claus Gittinger <cg@exept.de>
parents: 11339
diff changeset
 10054
    ^ self confirmWithCancel:aString defaultAnswer:nil
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
 10055
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
 10056
    "
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
 10057
     nil confirmWithCancel:'hello'
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10058
     self confirmWithCancel:'hello'
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10059
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10060
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10061
11366
97a8331d3e4c + confirmWithCancel defaultAnswer
Claus Gittinger <cg@exept.de>
parents: 11339
diff changeset
 10062
confirmWithCancel:aString defaultAnswer:defaultAnswerOrNil
97a8331d3e4c + confirmWithCancel defaultAnswer
Claus Gittinger <cg@exept.de>
parents: 11339
diff changeset
 10063
    "launch a confirmer, which allows user to enter yes, no or cancel.
97a8331d3e4c + confirmWithCancel defaultAnswer
Claus Gittinger <cg@exept.de>
parents: 11339
diff changeset
 10064
     return true for yes, false for no, nil for cancel.
97a8331d3e4c + confirmWithCancel defaultAnswer
Claus Gittinger <cg@exept.de>
parents: 11339
diff changeset
 10065
     If no GUI is present (headless applications), nil is returned.
97a8331d3e4c + confirmWithCancel defaultAnswer
Claus Gittinger <cg@exept.de>
parents: 11339
diff changeset
 10066
97a8331d3e4c + confirmWithCancel defaultAnswer
Claus Gittinger <cg@exept.de>
parents: 11339
diff changeset
 10067
     Someone in the sender chain may redefine the confirmation handler
97a8331d3e4c + confirmWithCancel defaultAnswer
Claus Gittinger <cg@exept.de>
parents: 11339
diff changeset
 10068
     by handling the UserConfirmation."
97a8331d3e4c + confirmWithCancel defaultAnswer
Claus Gittinger <cg@exept.de>
parents: 11339
diff changeset
 10069
97a8331d3e4c + confirmWithCancel defaultAnswer
Claus Gittinger <cg@exept.de>
parents: 11339
diff changeset
 10070
    ^ UserConfirmation new
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
 10071
        defaultAnswer:defaultAnswerOrNil;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
 10072
        canCancel:true;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
 10073
        errorString:aString;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
 10074
        raiseRequest
11366
97a8331d3e4c + confirmWithCancel defaultAnswer
Claus Gittinger <cg@exept.de>
parents: 11339
diff changeset
 10075
97a8331d3e4c + confirmWithCancel defaultAnswer
Claus Gittinger <cg@exept.de>
parents: 11339
diff changeset
 10076
    "
97a8331d3e4c + confirmWithCancel defaultAnswer
Claus Gittinger <cg@exept.de>
parents: 11339
diff changeset
 10077
     nil confirmWithCancel:'hello' defaultAnswer:true
97a8331d3e4c + confirmWithCancel defaultAnswer
Claus Gittinger <cg@exept.de>
parents: 11339
diff changeset
 10078
     self confirmWithCancel:'hello' defaultAnswer:false
97a8331d3e4c + confirmWithCancel defaultAnswer
Claus Gittinger <cg@exept.de>
parents: 11339
diff changeset
 10079
    "
97a8331d3e4c + confirmWithCancel defaultAnswer
Claus Gittinger <cg@exept.de>
parents: 11339
diff changeset
 10080
!
97a8331d3e4c + confirmWithCancel defaultAnswer
Claus Gittinger <cg@exept.de>
parents: 11339
diff changeset
 10081
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10082
errorNotify:aString
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10083
    "launch a Notifier, showing top stack, telling user something
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10084
     and give user a chance to enter debugger."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10085
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10086
    ^ self
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
 10087
        errorNotify:aString
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
 10088
        from:thisContext sender
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
 10089
        allowDebug:true
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
 10090
        mayProceed:true
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10091
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10092
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10093
     nil errorNotify:'hello there'
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10094
     self errorNotify:'hello there'
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10095
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10096
6199
5fcf06f17cee *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6196
diff changeset
 10097
    "Modified: / 16.11.2001 / 15:36:49 / cg"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10098
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10099
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10100
errorNotify:aString from:aContext
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
 10101
    "launch a Notifier, showing top stack (above aContext),
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10102
     telling user something and give user a chance to enter debugger."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10103
15255
62f7d4655ba8 class: Object
Stefan Vogel <sv@exept.de>
parents: 15243
diff changeset
 10104
    ^ self errorNotify:aString from:aContext allowDebug:true mayProceed:true
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10105
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10106
    "Modified: / 17.8.1998 / 10:09:27 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10107
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10108
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10109
errorNotify:aString from:aContext allowDebug:allowDebug
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
 10110
    "launch a Notifier, showing top stack (above aContext),
15255
62f7d4655ba8 class: Object
Stefan Vogel <sv@exept.de>
parents: 15243
diff changeset
 10111
     telling user something and give user a chance to enter debugger."
62f7d4655ba8 class: Object
Stefan Vogel <sv@exept.de>
parents: 15243
diff changeset
 10112
62f7d4655ba8 class: Object
Stefan Vogel <sv@exept.de>
parents: 15243
diff changeset
 10113
    ^ self errorNotify:aString from:aContext allowDebug:allowDebug mayProceed:true
62f7d4655ba8 class: Object
Stefan Vogel <sv@exept.de>
parents: 15243
diff changeset
 10114
!
62f7d4655ba8 class: Object
Stefan Vogel <sv@exept.de>
parents: 15243
diff changeset
 10115
62f7d4655ba8 class: Object
Stefan Vogel <sv@exept.de>
parents: 15243
diff changeset
 10116
errorNotify:aString from:aContext allowDebug:allowDebug mayProceed:mayProceed
62f7d4655ba8 class: Object
Stefan Vogel <sv@exept.de>
parents: 15243
diff changeset
 10117
    "launch a Notifier, showing top stack (above aContext),
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10118
     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
 10119
11314
0b6e06b60ebe changed the error-notifier for standAlone apps.
Claus Gittinger <cg@exept.de>
parents: 11244
diff changeset
 10120
    |currentScreen con sender action boxLabels boxValues default s|
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10121
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10122
    Smalltalk isInitialized ifFalse:[
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
 10123
        'errorNotification: ' print. aString printCR.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
 10124
        con := aContext ? thisContext methodHome.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
 10125
        con sender printAllLevels:10.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
 10126
        ^ nil
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
 10127
    ].
11531
30f1ba816a81 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11530
diff changeset
 10128
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
 10129
    (Dialog isNil
6647
79c298b93c07 #errorNotify -- allow copying the backtrace
Stefan Vogel <sv@exept.de>
parents: 6631
diff changeset
 10130
     or:[Screen isNil
79c298b93c07 #errorNotify -- allow copying the backtrace
Stefan Vogel <sv@exept.de>
parents: 6631
diff changeset
 10131
     or:[(currentScreen := Screen current) isNil
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
 10132
     or:[currentScreen isOpen not]]]) ifTrue:[
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
 10133
        "
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
 10134
         on systems without GUI, simply show
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
 10135
         the message on the Transcript and abort.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
 10136
        "
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
 10137
        Transcript showCR:aString.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
 10138
        AbortOperationRequest raise.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
 10139
        "not reached"
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
 10140
        ^ nil
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10141
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10142
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10143
    Processor activeProcessIsSystemProcess ifTrue:[
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
 10144
        action := #debug.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
 10145
        sender := aContext.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
 10146
        Debugger isNil ifTrue:[
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
 10147
            '****************** Caught Error while in SystemProcess ****************' errorPrintCR.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
 10148
            aString errorPrintCR.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
 10149
            Exception handle:[:ex |
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
 10150
                'Caught recursive error while printing backtrace:' errorPrintCR.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
 10151
                ex description errorPrintCR.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
 10152
            ] do:[
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
 10153
                thisContext fullPrintAll.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
 10154
            ].
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
 10155
            action := #abort.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
 10156
        ].
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10157
    ] ifFalse:[
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
 10158
        Dialog autoload.        "in case it's autoloaded"
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
 10159
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
 10160
        Error handle:[:ex |
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
 10161
            "/ a recursive error - quickly enter debugger
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
 10162
            "/ this happened, when I corrupted the Dialog class ...
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
 10163
            ('Object [error]: ' , ex description , ' caught in errorNotification') errorPrintCR.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
 10164
            action := #debug.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
 10165
            ex return.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
 10166
        ] do:[ |s|
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
 10167
            sender := aContext.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
 10168
            sender isNil ifTrue:[
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
 10169
                sender := thisContext methodHome sender.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
 10170
            ].
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
 10171
            con := sender.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
 10172
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
 10173
            "/ skip intermediate (signal & exception) contexts
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
 10174
            DebugView notNil ifTrue:[
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
 10175
                con := DebugView interestingContextFrom:sender
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
 10176
            ].
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
 10177
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
 10178
            "/ show the first few contexts
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
 10179
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
 10180
            s := CharacterWriteStream with:aString.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
 10181
            s cr; cr.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
 10182
            s nextPutLine:'Calling Chain:'.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
 10183
            s nextPutLine:'--------------------------------------------------------------'.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
 10184
            1 to:25 do:[:n |
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
 10185
                con notNil ifTrue:[
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
 10186
                    con printOn:s.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
 10187
                    s cr.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
 10188
                    con := con sender
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
 10189
                ]
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
 10190
            ].
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
 10191
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
 10192
            mayProceed ifTrue:[
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
 10193
                boxLabels := #('Proceed').
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
 10194
                boxValues := #(#proceed).
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
 10195
                default := #proceed.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
 10196
            ] ifFalse:[
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
 10197
                boxLabels := #().
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
 10198
                boxValues := #().
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
 10199
            ].
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
 10200
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
 10201
            AbortOperationRequest isHandled ifTrue:[
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
 10202
                default := #abort.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
 10203
                boxLabels := boxLabels , #('Abort').
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
 10204
                boxValues := boxValues , #(#abort).
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
 10205
                AbortAllOperationRequest isHandled ifTrue:[
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
 10206
                    boxLabels := boxLabels , #('Abort All').
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
 10207
                    boxValues := boxValues , #(#abortAll).
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
 10208
                ].
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
 10209
                true "allowDebug" ifTrue:[
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
 10210
                    boxLabels := boxLabels , #('Copy Trace and Abort').
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
 10211
                    boxValues := boxValues , #(#copyAndAbort).
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
 10212
                ].
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
 10213
            ] ifFalse:[
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
 10214
                mayProceed "and:[allowDebug]" ifTrue:[
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
 10215
                    boxLabels := boxLabels , #('Copy Trace and Proceed').
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
 10216
                    boxValues := boxValues , #(#copyAndProceed).
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
 10217
                ].
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
 10218
            ].
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
 10219
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
 10220
            (allowDebug and:[Debugger notNil]) ifTrue:[
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
 10221
                boxLabels := boxLabels , #('Debug').
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
 10222
                boxValues := boxValues , #(#debug).
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
 10223
                default := #debug.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
 10224
            ].
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
 10225
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
 10226
            action := Dialog
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
 10227
                    choose:s contents
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
 10228
                    label:('Exception [' , Processor activeProcess nameOrId , ']')
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
 10229
                    image:WarningBox errorIconBitmap
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
 10230
                    labels:boxLabels
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
 10231
                    values:boxValues
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
 10232
                    default:default
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
 10233
                    onCancel:nil.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
 10234
        ].
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10235
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10236
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10237
    action == #debug ifTrue:[
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
 10238
        ^ Debugger enter:sender withMessage:aString mayProceed:mayProceed
11236
c196f9dedf66 exception description in debugger
Claus Gittinger <cg@exept.de>
parents: 11221
diff changeset
 10239
    ].
c196f9dedf66 exception description in debugger
Claus Gittinger <cg@exept.de>
parents: 11221
diff changeset
 10240
    action == #proceed ifTrue:[
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
 10241
        ^ nil.
11335
c061d08b766f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11314
diff changeset
 10242
    ].
c061d08b766f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11314
diff changeset
 10243
    (action == #copyAndProceed
c061d08b766f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11314
diff changeset
 10244
    or:[action == #copyAndAbort]) ifTrue:[
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
 10245
        s := '' writeStream.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
 10246
        Exception handle:[:ex |
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
 10247
            'Caught recursive error while printing backtrace' errorPrintCR.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
 10248
        ] do:[
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
 10249
            sender fullPrintAllOn:s.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
 10250
        ].
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
 10251
        currentScreen rootView setClipboardText:s contents.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
 10252
        action == #copyAndProceed ifTrue:[
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
 10253
            ^ nil
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
 10254
        ].
17306
29dcfbfb331c class: Object
Claus Gittinger <cg@exept.de>
parents: 17261
diff changeset
 10255
    ].
29dcfbfb331c class: Object
Claus Gittinger <cg@exept.de>
parents: 17261
diff changeset
 10256
    (action == #abortAll) ifTrue:[
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
 10257
        AbortAllOperationRequest raise
18215
5940d5eff81b java preps
Claus Gittinger <cg@exept.de>
parents: 18185
diff changeset
 10258
    ].
11314
0b6e06b60ebe changed the error-notifier for standAlone apps.
Claus Gittinger <cg@exept.de>
parents: 11244
diff changeset
 10259
11236
c196f9dedf66 exception description in debugger
Claus Gittinger <cg@exept.de>
parents: 11221
diff changeset
 10260
    AbortOperationRequest raise.
c196f9dedf66 exception description in debugger
Claus Gittinger <cg@exept.de>
parents: 11221
diff changeset
 10261
    "not reached"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10262
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10263
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10264
     nil errorNotify:'hello there'
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10265
     self errorNotify:'hello there'
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10266
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10267
13165
66a6b37405d1 changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13162
diff changeset
 10268
    "Created: / 17-08-1998 / 10:09:26 / cg"
13566
fc4e1055263d changed: #errorNotify:from:allowDebug:
sr
parents: 13565
diff changeset
 10269
    "Modified: / 08-08-2011 / 11:26:17 / sr"
13844
f03a655457f4 changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13812
diff changeset
 10270
    "Modified: / 05-12-2011 / 03:50:59 / cg"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10271
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10272
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10273
information:aString
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
 10274
    "launch an InfoBox, telling user something.
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
 10275
     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
 10276
     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
 10277
     Use #notify: for more important messages.
8371
4493f5ac7405 *** empty log message ***
ca
parents: 8330
diff changeset
 10278
     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
 10279
     pops up an info dialog."
7033
c4183ea85a71 Now Warning is a subclass of UserNotification.
Stefan Vogel <sv@exept.de>
parents: 7031
diff changeset
 10280
7035
1d049fb7ae5a Make UserInformation a class based exception
Stefan Vogel <sv@exept.de>
parents: 7033
diff changeset
 10281
    UserInformation raiseRequestWith:self errorString:aString
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10282
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10283
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10284
     nil information:'hello there'
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10285
     self information:'hello there'
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10286
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10287
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10288
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10289
     InformationSignal handle:[:ex |
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
 10290
        'no box popped' printCR.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
 10291
        ex proceed.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10292
     ] do:[
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
 10293
        'hello' printCR.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
 10294
        self information:'some info'.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
 10295
        'world' printCR.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10296
     ]
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10297
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10298
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10299
    "Modified: 24.11.1995 / 22:29:49 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10300
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10301
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10302
notify:aString
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10303
    "launch a Notifier, telling user something.
7033
c4183ea85a71 Now Warning is a subclass of UserNotification.
Stefan Vogel <sv@exept.de>
parents: 7031
diff changeset
 10304
     Use #information: for ignorable messages.
c4183ea85a71 Now Warning is a subclass of UserNotification.
Stefan Vogel <sv@exept.de>
parents: 7031
diff changeset
 10305
     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
 10306
     pops up a warn dialog."
c4183ea85a71 Now Warning is a subclass of UserNotification.
Stefan Vogel <sv@exept.de>
parents: 7031
diff changeset
 10307
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10308
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10309
    Smalltalk isInitialized ifFalse:[
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
 10310
        "/ thisContext fullPrintAll.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
 10311
        'information: ' print. aString printCR.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
 10312
        ^ self
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10313
    ].
7033
c4183ea85a71 Now Warning is a subclass of UserNotification.
Stefan Vogel <sv@exept.de>
parents: 7031
diff changeset
 10314
    UserNotification raiseRequestWith:self errorString:aString.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10315
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10316
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10317
     nil notify:'hello there'
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10318
     self notify:'hello there'
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10319
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10320
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10321
    "Modified: 20.5.1996 / 10:28:48 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10322
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10323
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10324
warn:aString
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10325
    "launch a WarningBox, telling user something.
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
 10326
     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
 10327
     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
 10328
     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
 10329
     pops up a warn dialog."
c4183ea85a71 Now Warning is a subclass of UserNotification.
Stefan Vogel <sv@exept.de>
parents: 7031
diff changeset
 10330
c4183ea85a71 Now Warning is a subclass of UserNotification.
Stefan Vogel <sv@exept.de>
parents: 7031
diff changeset
 10331
    Warning raiseRequestWith:self errorString:aString
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10332
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10333
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10334
     nil warn:'hello there'
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10335
     self warn:'hello there'
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10336
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10337
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10338
    "
7033
c4183ea85a71 Now Warning is a subclass of UserNotification.
Stefan Vogel <sv@exept.de>
parents: 7031
diff changeset
 10339
     Warning handle:[:ex |
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
 10340
        Transcript showCR:ex description.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
 10341
        ex proceed.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10342
     ] do:[
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
 10343
        'hello' printCR.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
 10344
        self warn:'some info'.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
 10345
        'world' printCR.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10346
     ]
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10347
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10348
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10349
    "Modified: 20.5.1996 / 10:28:53 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10350
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10351
8397
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
 10352
!Object methodsFor:'visiting'!
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
 10353
8426
b4195c5f9450 +acceptVisitor
Claus Gittinger <cg@exept.de>
parents: 8413
diff changeset
 10354
acceptVisitor:aVisitor
b4195c5f9450 +acceptVisitor
Claus Gittinger <cg@exept.de>
parents: 8413
diff changeset
 10355
    "double-dispatch onto a Visitor."
b4195c5f9450 +acceptVisitor
Claus Gittinger <cg@exept.de>
parents: 8413
diff changeset
 10356
b4195c5f9450 +acceptVisitor
Claus Gittinger <cg@exept.de>
parents: 8413
diff changeset
 10357
    ^ self acceptVisitor:aVisitor with:nil
b4195c5f9450 +acceptVisitor
Claus Gittinger <cg@exept.de>
parents: 8413
diff changeset
 10358
!
b4195c5f9450 +acceptVisitor
Claus Gittinger <cg@exept.de>
parents: 8413
diff changeset
 10359
8397
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
 10360
acceptVisitor:aVisitor with:aParameter
16732
4ba89483ebfa comment/format only
Claus Gittinger <cg@exept.de>
parents: 16591
diff changeset
 10361
    "double-dispatch via visitObject:with: into a Visitor.
4ba89483ebfa comment/format only
Claus Gittinger <cg@exept.de>
parents: 16591
diff changeset
 10362
     Subclasses redefine this to pass their type in the message name (i.e. visitXXX:)"
8397
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
 10363
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
 10364
    ^ aVisitor visitObject:self with:aParameter
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
 10365
! !
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
 10366
20027
5be764ee44fb #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 19846
diff changeset
 10367
5be764ee44fb #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 19846
diff changeset
 10368
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10369
!Object class methodsFor:'documentation'!
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
 10370
14056
24d7f7bf46c7 inspector2TabForBasicInspect
Claus Gittinger <cg@exept.de>
parents: 14055
diff changeset
 10371
version
18620
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18440
diff changeset
 10372
    ^ '$Header$'
14056
24d7f7bf46c7 inspector2TabForBasicInspect
Claus Gittinger <cg@exept.de>
parents: 14055
diff changeset
 10373
!
24d7f7bf46c7 inspector2TabForBasicInspect
Claus Gittinger <cg@exept.de>
parents: 14055
diff changeset
 10374
12050
bd0013f79e4f added: #notYetImplemented
Claus Gittinger <cg@exept.de>
parents: 11976
diff changeset
 10375
version_CVS
18620
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18440
diff changeset
 10376
    ^ '$Header$'
13416
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
 10377
!
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
 10378
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
 10379
version_SVN
15243
8b2249151890 class: Object
Stefan Vogel <sv@exept.de>
parents: 15222
diff changeset
 10380
    ^ '$ Id: Object.st 10643 2011-06-08 21:53:07Z vranyj1  $'
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
 10381
! !
6764
c5455cf45678 perform:withOptional*
Claus Gittinger <cg@exept.de>
parents: 6741
diff changeset
 10382
14661
2a5c79daa934 class: Object
Stefan Vogel <sv@exept.de>
parents: 14632
diff changeset
 10383
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10384
Object initialize!