Object.st
author Claus Gittinger <cg@exept.de>
Wed, 22 Nov 2000 11:56:15 +0100
changeset 5724 96c2a5cf4217
parent 5706 9c49e9b54c45
child 5754 333aba8041c2
permissions -rw-r--r--
category: and package: now send change notifications.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
     1
"
5
67342904af11 *** empty log message ***
claus
parents: 3
diff changeset
     2
 COPYRIGHT (c) 1988 by Claus Gittinger
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
     3
              All Rights Reserved
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
     4
a27a279701f8 Initial revision
claus
parents:
diff changeset
     5
 This software is furnished under a license and may be used
a27a279701f8 Initial revision
claus
parents:
diff changeset
     6
 only in accordance with the terms of that license and with the
a27a279701f8 Initial revision
claus
parents:
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
a27a279701f8 Initial revision
claus
parents:
diff changeset
     8
 be provided or otherwise made available to, or used by, any
a27a279701f8 Initial revision
claus
parents:
diff changeset
     9
 other person.  No title to or ownership of the software is
a27a279701f8 Initial revision
claus
parents:
diff changeset
    10
 hereby transferred.
a27a279701f8 Initial revision
claus
parents:
diff changeset
    11
"
a27a279701f8 Initial revision
claus
parents:
diff changeset
    12
5354
1df6e20fd208 added isHierarchicalItem
ca
parents: 5327
diff changeset
    13
"{ Package: 'stx:libbasic' }"
1df6e20fd208 added isHierarchicalItem
ca
parents: 5327
diff changeset
    14
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
    15
nil subclass:#Object
5367
76120309ae8b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5356
diff changeset
    16
	instanceVariableNames:''
76120309ae8b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5356
diff changeset
    17
	classVariableNames:'ErrorSignal HaltSignal MessageNotUnderstoodSignal
76120309ae8b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5356
diff changeset
    18
		UserInterruptSignal RecursionInterruptSignal
76120309ae8b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5356
diff changeset
    19
		ExceptionInterruptSignal SubscriptOutOfBoundsSignal
76120309ae8b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5356
diff changeset
    20
		IndexNotFoundSignal NonIntegerIndexSignal NotFoundSignal
76120309ae8b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5356
diff changeset
    21
		KeyNotFoundSignal ElementOutOfBoundsSignal UserNotificationSignal
76120309ae8b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5356
diff changeset
    22
		InformationSignal WarningSignal PrimitiveFailureSignal
76120309ae8b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5356
diff changeset
    23
		DeepCopyErrorSignal AbortSignal ErrorRecursion Dependencies
76120309ae8b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5356
diff changeset
    24
		InfoPrinting ActivityNotificationSignal InternalErrorSignal
76120309ae8b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5356
diff changeset
    25
		NonWeakDependencies SynchronizationSemaphores ObjectAttributes
5498
489dc2e6bd4f RecursiveStoreStringSignal lifted to Object
tm
parents: 5495
diff changeset
    26
		OSSignalInterruptSignal FinalizationLobby
5706
9c49e9b54c45 added AbortAllSignal
Claus Gittinger <cg@exept.de>
parents: 5686
diff changeset
    27
		RecursiveStoreStringSignal AbortAllSignal'
5367
76120309ae8b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5356
diff changeset
    28
	poolDictionaries:''
76120309ae8b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5356
diff changeset
    29
	category:'Kernel-Objects'
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
    30
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
    31
1788
0c71ba975d34 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1780
diff changeset
    32
!Object class methodsFor:'documentation'!
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
    33
88
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    34
copyright
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    35
"
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    36
 COPYRIGHT (c) 1988 by Claus Gittinger
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
    37
              All Rights Reserved
88
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    38
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    39
 This software is furnished under a license and may be used
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    40
 only in accordance with the terms of that license and with the
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    41
 inclusion of the above copyright notice.   This software may not
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    42
 be provided or otherwise made available to, or used by, any
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    43
 other person.  No title to or ownership of the software is
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    44
 hereby transferred.
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    45
"
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    46
!
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    47
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
    48
dependencies
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
    49
"
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
    50
   ST/X dependencies are slightly modified from ST-80's 
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
    51
   (we think they are better ;-).
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
    52
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
    53
   One problem occuring very often in ST-80 is that some object
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
    54
   cannot be garbage collected because some dependency is present,
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
    55
   having the object as a dependent of some other object.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
    56
   In ST-80, this association remains alive (because a Dictionary
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
    57
   is used to hold dependents) - even if no other references exist to
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
    58
   to dependent or the dependee.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
    59
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
    60
   This means, that in ST-80, a #release is mandatory in order to
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
    61
   prevent memory leaks.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
    62
   We think, that this is a bad solution, since after all, exactly that
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
    63
   kind of work should be performed by a garbage collector - you should not
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
    64
   need to care about dependencies.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
    65
   From a philosophical point of view, why should some object depend on 
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
    66
   something that the programmer considers a dead object ?
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
    67
   (well - worse than that: it seems that some ST-80 code even depends on
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
    68
    that behavior)
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
    69
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
    70
   In order to limit the trouble, ST-80 reimplemented the way dependents
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
    71
   are stored in the model class - this one keeps the dependents locally,
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
    72
   so these dependents go away, once the model is reclaimed.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
    73
   That may make things even more confusing: with models, no #release is
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
    74
   needed, with general objects it is mandatory.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
    75
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
    76
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
    77
   In ST/X, dependencies are implemented using a WeakDictionary; this means,
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
    78
   that once the dependee dies, the dependency association is removed automatically,
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
    79
   and the dependent can be reclaimed by the garbage collector, if no other
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
    80
   references exist to the dependent.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
    81
   In order to (at least) provide a mechanism for the old behavior
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
    82
   (in case your application heavily depends on the ST-80 mechanism), complementary
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
    83
   protocol to add nonWeak dependencies is provided 
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
    84
   (see #addNonWeakDependent / #removeNonWeakDependent).
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
    85
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
    86
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
    87
   Caveat:
1751
0902cadafee2 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1705
diff changeset
    88
      since interests are implemented using InterestConverter (which are simply
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
    89
      forwarding messages), these must use the nonWeak mechanism (as done in ST-80
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
    90
      automatically).
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
    91
      The reason is that there are usually no direct references to the converters,
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
    92
      and those would be reclaimed if stored in a weakDictionary.
1751
0902cadafee2 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1705
diff changeset
    93
      This means, that those interests MUST be removed with #retractInterest
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
    94
      (which is bug-compatible to ST-80). 
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
    95
      We rewrite things to provide a more convenient mechanism in the future ...
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
    96
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
    97
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
    98
   I like to hear comments on the above - do you think its better ?
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
    99
"
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   100
!
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   101
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
   102
documentation
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
   103
"
1294
e26bbb61f6b2 documentation
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
   104
   Object is the superclass of most other classes. 
e26bbb61f6b2 documentation
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
   105
   (except for nil-subclasses, which inherit nothing,
e26bbb61f6b2 documentation
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
   106
    to catch any message into their #doesNotUnderstand: method)
e26bbb61f6b2 documentation
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
   107
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   108
   Protocol which is common to every object is defined here.
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
   109
   Also some utility stuff (like notify) and error handling is implemented here.
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
   110
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
   111
   Object has no instance variables (and may not get any added). One reason is, that
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   112
   UndefinedObject and SmallInteger are also inheriting from Object - these two cannot 
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   113
   have instance variables (due to their implementation). 
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   114
   The other reason is that the runtime system (VM) knows about the layout of some built-in 
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   115
   classes (think of Class, Method, Block and also Integer or Float). 
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   116
   If you were allowed to add instance variables to Object, the VM had to be recompiled 
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   117
   (and also rewritten in some places).
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
   118
1294
e26bbb61f6b2 documentation
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
   119
   [Class variables:]
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
   120
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
   121
        ErrorSignal     <Signal>        Signal raised for error/error: messages
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
   122
                                        also, parent of all other signals.
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
   123
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
   124
        HaltSignal      <Signal>        Signal raised for halt/halt: messages
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
   125
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
   126
        MessageNotUnderstoodSignal      Signals raised for various error conditions
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
   127
        UserInterruptSignal
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
   128
        RecursionInterruptSignal 
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
   129
        ExceptionInterruptSignal
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
   130
        SubscriptOutOfBoundsSignal 
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
   131
        NonIntegerIndexSignal
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
   132
        NotFoundSignal 
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
   133
        KeyNotFoundSignal 
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
   134
        ElementOutOfBoundsSignal
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
   135
        InformationSignal
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
   136
        WarningSignal
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
   137
        DeepCopyErrorSignal
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
   138
        InternalErrorSignal
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
   139
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
   140
        AbortSignal      <Signal>       Signal raised by debugger, to abort a computation
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
   141
                                        BUT, the debugger will only raise it if it is handled.
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
   142
                                        By handling the abortSignal, you can control where the
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
   143
                                        debuggers abort-function resumes execution in case of
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
   144
                                        an error.
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
   145
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
   146
        ErrorRecursion   <Boolean>      controls behavior when recursive errors occur (i.e. 
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
   147
                                        an error while handling an error).
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
   148
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
   149
        Dependencies     <WeakDependencyDictionary>  
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
   150
                                        keeps track of object dependencies.
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
   151
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
   152
        InfoPrinting     <Boolean>      controls weather informational messages 
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
   153
                                        are printed.
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
   154
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
   155
        ActivityNotificationSignal <QuerySignal> 
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
   156
                                         raised on #activityNotification:
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
   157
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
   158
        NonWeakDependencies <Dictionary> keeps track of object dependencies.
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
   159
                                         Dependents stay alive.
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
   160
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
   161
        SynchronizationSemaphores <WeakIdentityDictionary>
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
   162
                                         Semaphores for per-object-monitor.
2295
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
   163
                                        
1294
e26bbb61f6b2 documentation
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
   164
e26bbb61f6b2 documentation
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
   165
    [author:]
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
   166
        Claus Gittinger
1294
e26bbb61f6b2 documentation
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
   167
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
   168
"
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
   169
! !
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   170
1788
0c71ba975d34 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1780
diff changeset
   171
!Object class methodsFor:'initialization'!
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   172
a27a279701f8 Initial revision
claus
parents:
diff changeset
   173
initialize
a27a279701f8 Initial revision
claus
parents:
diff changeset
   174
    "called only once - initialize signals"
a27a279701f8 Initial revision
claus
parents:
diff changeset
   175
a27a279701f8 Initial revision
claus
parents:
diff changeset
   176
    ErrorSignal isNil ifTrue:[
4520
57362111e454 ErrorSignal is now the class based exception Error.
Stefan Vogel <sv@exept.de>
parents: 4499
diff changeset
   177
        ErrorSignal := Error.
3999
57e83b6efee1 SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents: 3994
diff changeset
   178
4866
c2b3ca7c0e70 HaltSignal (and BreakpointSignal) is no longer a child of Error.
Claus Gittinger <cg@exept.de>
parents: 4858
diff changeset
   179
        HaltSignal := Exception newSignalMayProceed:true.
3999
57e83b6efee1 SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents: 3994
diff changeset
   180
        HaltSignal nameClass:self message:#haltSignal.
57e83b6efee1 SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents: 3994
diff changeset
   181
        HaltSignal notifierString:'halt encountered'.
57e83b6efee1 SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents: 3994
diff changeset
   182
57e83b6efee1 SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents: 3994
diff changeset
   183
        MessageNotUnderstoodSignal := ErrorSignal newSignalMayProceed:true.
57e83b6efee1 SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents: 3994
diff changeset
   184
        MessageNotUnderstoodSignal nameClass:self message:#messageNotUnderstoodSignal.
57e83b6efee1 SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents: 3994
diff changeset
   185
        MessageNotUnderstoodSignal notifierString:'message not understood'.
57e83b6efee1 SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents: 3994
diff changeset
   186
57e83b6efee1 SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents: 3994
diff changeset
   187
        PrimitiveFailureSignal := ErrorSignal newSignalMayProceed:true.
57e83b6efee1 SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents: 3994
diff changeset
   188
        PrimitiveFailureSignal nameClass:self message:#primitiveFailureSignal.
57e83b6efee1 SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents: 3994
diff changeset
   189
        PrimitiveFailureSignal notifierString:'primitive failed'.
57e83b6efee1 SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents: 3994
diff changeset
   190
57e83b6efee1 SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents: 3994
diff changeset
   191
        InternalErrorSignal := ErrorSignal newSignalMayProceed:false.
57e83b6efee1 SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents: 3994
diff changeset
   192
        InternalErrorSignal nameClass:self message:#internalErrorSignal.
57e83b6efee1 SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents: 3994
diff changeset
   193
        InternalErrorSignal notifierString:'VM internal error: '.
2227
eb1e28c62f14 use an extra signal for internal errors
Claus Gittinger <cg@exept.de>
parents: 2209
diff changeset
   194
362
claus
parents: 359
diff changeset
   195
"/        UserInterruptSignal := ErrorSignal newSignalMayProceed:true.
3999
57e83b6efee1 SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents: 3994
diff changeset
   196
        UserInterruptSignal := (Signal new) mayProceed:true.
57e83b6efee1 SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents: 3994
diff changeset
   197
        UserInterruptSignal nameClass:self message:#userInterruptSignal.
57e83b6efee1 SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents: 3994
diff changeset
   198
        UserInterruptSignal notifierString:'user Interrupt'.
159
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
   199
362
claus
parents: 359
diff changeset
   200
"/        RecursionInterruptSignal := ErrorSignal newSignalMayProceed:false.
3999
57e83b6efee1 SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents: 3994
diff changeset
   201
        RecursionInterruptSignal := (Signal new) mayProceed:true.
57e83b6efee1 SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents: 3994
diff changeset
   202
        RecursionInterruptSignal nameClass:self message:#recursionInterruptSignal.
57e83b6efee1 SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents: 3994
diff changeset
   203
        RecursionInterruptSignal notifierString:'recursion limit reached'.
57e83b6efee1 SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents: 3994
diff changeset
   204
57e83b6efee1 SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents: 3994
diff changeset
   205
        ExceptionInterruptSignal := ErrorSignal newSignalMayProceed:true.
57e83b6efee1 SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents: 3994
diff changeset
   206
        ExceptionInterruptSignal nameClass:self message:#exceptionInterruptSignal.
57e83b6efee1 SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents: 3994
diff changeset
   207
        ExceptionInterruptSignal notifierString:'exception Interrupt'.
57e83b6efee1 SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents: 3994
diff changeset
   208
57e83b6efee1 SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents: 3994
diff changeset
   209
        NotFoundSignal := ErrorSignal newSignalMayProceed:true.
57e83b6efee1 SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents: 3994
diff changeset
   210
        NotFoundSignal nameClass:self message:#notFoundSignal.
57e83b6efee1 SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents: 3994
diff changeset
   211
        NotFoundSignal notifierString:'no such element'.
57e83b6efee1 SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents: 3994
diff changeset
   212
57e83b6efee1 SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents: 3994
diff changeset
   213
        IndexNotFoundSignal := NotFoundSignal newSignalMayProceed:true.
57e83b6efee1 SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents: 3994
diff changeset
   214
        IndexNotFoundSignal nameClass:self message:#indexNotFoundSignal.
57e83b6efee1 SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents: 3994
diff changeset
   215
        IndexNotFoundSignal notifierString:'bad index: '.
57e83b6efee1 SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents: 3994
diff changeset
   216
57e83b6efee1 SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents: 3994
diff changeset
   217
        SubscriptOutOfBoundsSignal := IndexNotFoundSignal newSignalMayProceed:true.
57e83b6efee1 SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents: 3994
diff changeset
   218
        SubscriptOutOfBoundsSignal nameClass:self message:#subscriptOutOfBoundsSignal.
57e83b6efee1 SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents: 3994
diff changeset
   219
        SubscriptOutOfBoundsSignal notifierString:'subscript out of bounds: '.
57e83b6efee1 SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents: 3994
diff changeset
   220
57e83b6efee1 SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents: 3994
diff changeset
   221
        ElementOutOfBoundsSignal := ErrorSignal newSignalMayProceed:false.
57e83b6efee1 SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents: 3994
diff changeset
   222
        ElementOutOfBoundsSignal nameClass:self message:#elementOutOfBoundsSignal.
57e83b6efee1 SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents: 3994
diff changeset
   223
        ElementOutOfBoundsSignal notifierString:'element not appropriate or out of bounds'.
57e83b6efee1 SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents: 3994
diff changeset
   224
57e83b6efee1 SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents: 3994
diff changeset
   225
        KeyNotFoundSignal := NotFoundSignal newSignalMayProceed:true.
57e83b6efee1 SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents: 3994
diff changeset
   226
        KeyNotFoundSignal nameClass:self message:#keyNotFoundSignal.
57e83b6efee1 SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents: 3994
diff changeset
   227
        KeyNotFoundSignal notifierString:'no such key: '.
57e83b6efee1 SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents: 3994
diff changeset
   228
57e83b6efee1 SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents: 3994
diff changeset
   229
        NonIntegerIndexSignal := IndexNotFoundSignal newSignalMayProceed:true.
57e83b6efee1 SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents: 3994
diff changeset
   230
        NonIntegerIndexSignal nameClass:self message:#nonIntegerIndexSignal.
57e83b6efee1 SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents: 3994
diff changeset
   231
        NonIntegerIndexSignal notifierString:'index must be integer'.
57e83b6efee1 SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents: 3994
diff changeset
   232
57e83b6efee1 SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents: 3994
diff changeset
   233
        UserNotificationSignal := QuerySignal new.
57e83b6efee1 SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents: 3994
diff changeset
   234
        UserNotificationSignal nameClass:self message:#userNotificationSignal.
57e83b6efee1 SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents: 3994
diff changeset
   235
        UserNotificationSignal notifierString:'user notifiaction wanted'.
57e83b6efee1 SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents: 3994
diff changeset
   236
57e83b6efee1 SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents: 3994
diff changeset
   237
        InformationSignal := UserNotificationSignal newSignalMayProceed:true.
57e83b6efee1 SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents: 3994
diff changeset
   238
        InformationSignal nameClass:self message:#informationSignal.
57e83b6efee1 SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents: 3994
diff changeset
   239
        InformationSignal notifierString:'information'.
57e83b6efee1 SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents: 3994
diff changeset
   240
57e83b6efee1 SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents: 3994
diff changeset
   241
        WarningSignal := UserNotificationSignal newSignalMayProceed:true.
4053
eb3063f80058 Fix typo: warnungSignal
Stefan Vogel <sv@exept.de>
parents: 4009
diff changeset
   242
        WarningSignal nameClass:self message:#warningSignal.
3999
57e83b6efee1 SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents: 3994
diff changeset
   243
        WarningSignal notifierString:'warning'.
57e83b6efee1 SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents: 3994
diff changeset
   244
57e83b6efee1 SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents: 3994
diff changeset
   245
        ActivityNotificationSignal := UserNotificationSignal newSignalMayProceed:true.
57e83b6efee1 SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents: 3994
diff changeset
   246
        ActivityNotificationSignal nameClass:self message:#activityNotificationSignal.
57e83b6efee1 SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents: 3994
diff changeset
   247
        ActivityNotificationSignal notifierString:'activity'.
57e83b6efee1 SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents: 3994
diff changeset
   248
57e83b6efee1 SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents: 3994
diff changeset
   249
        DeepCopyErrorSignal := ErrorSignal newSignalMayProceed:true.
57e83b6efee1 SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents: 3994
diff changeset
   250
        DeepCopyErrorSignal nameClass:self message:#deepCopyErrorSignal.
57e83b6efee1 SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents: 3994
diff changeset
   251
        DeepCopyErrorSignal notifierString:'object cannot be deepCopy-ed'.
57e83b6efee1 SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents: 3994
diff changeset
   252
57e83b6efee1 SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents: 3994
diff changeset
   253
        "
57e83b6efee1 SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents: 3994
diff changeset
   254
         AbortSignal is not a child of ErrorSignal -
57e83b6efee1 SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents: 3994
diff changeset
   255
         this would complicate abort from within a signal handler
57e83b6efee1 SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents: 3994
diff changeset
   256
        "
57e83b6efee1 SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents: 3994
diff changeset
   257
        AbortSignal := Signal genericSignal newSignalMayProceed:true.
57e83b6efee1 SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents: 3994
diff changeset
   258
        AbortSignal nameClass:self message:#abortSignal.
57e83b6efee1 SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents: 3994
diff changeset
   259
        AbortSignal notifierString:'unhandled abort signal'.
57e83b6efee1 SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents: 3994
diff changeset
   260
5706
9c49e9b54c45 added AbortAllSignal
Claus Gittinger <cg@exept.de>
parents: 5686
diff changeset
   261
        AbortAllSignal := Signal genericSignal newSignalMayProceed:true.
9c49e9b54c45 added AbortAllSignal
Claus Gittinger <cg@exept.de>
parents: 5686
diff changeset
   262
        AbortAllSignal nameClass:self message:#abortAllSignal.
9c49e9b54c45 added AbortAllSignal
Claus Gittinger <cg@exept.de>
parents: 5686
diff changeset
   263
        AbortAllSignal notifierString:'unhandled abortAll signal'.
9c49e9b54c45 added AbortAllSignal
Claus Gittinger <cg@exept.de>
parents: 5686
diff changeset
   264
3999
57e83b6efee1 SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents: 3994
diff changeset
   265
        "
57e83b6efee1 SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents: 3994
diff changeset
   266
         OSSignalInterruptSignal is not a child of ErrorSignal -
57e83b6efee1 SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents: 3994
diff changeset
   267
         it requires explicit catching.
57e83b6efee1 SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents: 3994
diff changeset
   268
         If unhandled, a debugger is entered.
57e83b6efee1 SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents: 3994
diff changeset
   269
        "
57e83b6efee1 SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents: 3994
diff changeset
   270
        OSSignalInterruptSignal := Signal genericSignal newSignalMayProceed:true.
57e83b6efee1 SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents: 3994
diff changeset
   271
        OSSignalInterruptSignal nameClass:self message:#osSignalInterruptSignal.
57e83b6efee1 SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents: 3994
diff changeset
   272
        OSSignalInterruptSignal notifierString:'OS signal interrupt'.
57e83b6efee1 SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents: 3994
diff changeset
   273
5498
489dc2e6bd4f RecursiveStoreStringSignal lifted to Object
tm
parents: 5495
diff changeset
   274
        RecursiveStoreStringSignal := QuerySignal new.
489dc2e6bd4f RecursiveStoreStringSignal lifted to Object
tm
parents: 5495
diff changeset
   275
        RecursiveStoreStringSignal nameClass:self message:#recursiveStoreStringSignal.
489dc2e6bd4f RecursiveStoreStringSignal lifted to Object
tm
parents: 5495
diff changeset
   276
        RecursiveStoreStringSignal notifierString:'attempt to generate storeString of recursive object'.
489dc2e6bd4f RecursiveStoreStringSignal lifted to Object
tm
parents: 5495
diff changeset
   277
3999
57e83b6efee1 SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents: 3994
diff changeset
   278
        ObjectAttributes isNil ifTrue:[
57e83b6efee1 SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents: 3994
diff changeset
   279
            ObjectAttributes := WeakIdentityDictionary new.
57e83b6efee1 SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents: 3994
diff changeset
   280
        ].
57e83b6efee1 SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents: 3994
diff changeset
   281
57e83b6efee1 SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents: 3994
diff changeset
   282
        Dependencies isNil ifTrue:[
57e83b6efee1 SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents: 3994
diff changeset
   283
            Dependencies := WeakDependencyDictionary new.
57e83b6efee1 SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents: 3994
diff changeset
   284
        ].
57e83b6efee1 SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents: 3994
diff changeset
   285
        NonWeakDependencies isNil ifTrue:[
57e83b6efee1 SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents: 3994
diff changeset
   286
            NonWeakDependencies := IdentityDictionary new.
57e83b6efee1 SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents: 3994
diff changeset
   287
        ].
57e83b6efee1 SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents: 3994
diff changeset
   288
        SynchronizationSemaphores isNil ifTrue:[
57e83b6efee1 SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents: 3994
diff changeset
   289
            SynchronizationSemaphores := WeakIdentityDictionary new.
57e83b6efee1 SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents: 3994
diff changeset
   290
        ].
356
claus
parents: 348
diff changeset
   291
    ].
2114
706cf3f9019a initialize InfoPrinting flag from VM's setting
Claus Gittinger <cg@exept.de>
parents: 2096
diff changeset
   292
4873
1642bad0297f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4866
diff changeset
   293
    FinalizationLobby isNil ifTrue:[
1642bad0297f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4866
diff changeset
   294
        FinalizationLobby := Registry new.
1642bad0297f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4866
diff changeset
   295
    ].
1642bad0297f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4866
diff changeset
   296
2114
706cf3f9019a initialize InfoPrinting flag from VM's setting
Claus Gittinger <cg@exept.de>
parents: 2096
diff changeset
   297
    "/ initialize InfoPrinting to the VM's infoPrint setting
706cf3f9019a initialize InfoPrinting flag from VM's setting
Claus Gittinger <cg@exept.de>
parents: 2096
diff changeset
   298
    "/ (which can be turned off via a command line argument)
706cf3f9019a initialize InfoPrinting flag from VM's setting
Claus Gittinger <cg@exept.de>
parents: 2096
diff changeset
   299
    InfoPrinting := ObjectMemory infoPrinting.
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   300
a27a279701f8 Initial revision
claus
parents:
diff changeset
   301
    "Object initialize"
812
00db9c0646fe notificationsignals are no longer children of ErrorSignal
Claus Gittinger <cg@exept.de>
parents: 783
diff changeset
   302
3268
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
   303
    "Modified: / 22.1.1998 / 21:23:40 / av"
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
   304
    "Modified: / 3.2.1998 / 18:55:09 / cg"
4520
57362111e454 ErrorSignal is now the class based exception Error.
Stefan Vogel <sv@exept.de>
parents: 4499
diff changeset
   305
    "Modified: / 4.8.1999 / 08:54:06 / stefan"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   306
! !
a27a279701f8 Initial revision
claus
parents:
diff changeset
   307
4873
1642bad0297f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4866
diff changeset
   308
!Object class methodsFor:'Compatibility - ST80'!
3175
b0181a625671 #rootError for ST80 compatibility (same as errorSignal)
Stefan Vogel <sv@exept.de>
parents: 3159
diff changeset
   309
b0181a625671 #rootError for ST80 compatibility (same as errorSignal)
Stefan Vogel <sv@exept.de>
parents: 3159
diff changeset
   310
rootError
b0181a625671 #rootError for ST80 compatibility (same as errorSignal)
Stefan Vogel <sv@exept.de>
parents: 3159
diff changeset
   311
    "return the signal used for error/error: - handling.
b0181a625671 #rootError for ST80 compatibility (same as errorSignal)
Stefan Vogel <sv@exept.de>
parents: 3159
diff changeset
   312
     Same as errorSignal for ST80 compatibility."
b0181a625671 #rootError for ST80 compatibility (same as errorSignal)
Stefan Vogel <sv@exept.de>
parents: 3159
diff changeset
   313
b0181a625671 #rootError for ST80 compatibility (same as errorSignal)
Stefan Vogel <sv@exept.de>
parents: 3159
diff changeset
   314
    ^ ErrorSignal
b0181a625671 #rootError for ST80 compatibility (same as errorSignal)
Stefan Vogel <sv@exept.de>
parents: 3159
diff changeset
   315
b0181a625671 #rootError for ST80 compatibility (same as errorSignal)
Stefan Vogel <sv@exept.de>
parents: 3159
diff changeset
   316
    "Created: / 15.1.1998 / 23:47:05 / stefan"
b0181a625671 #rootError for ST80 compatibility (same as errorSignal)
Stefan Vogel <sv@exept.de>
parents: 3159
diff changeset
   317
! !
b0181a625671 #rootError for ST80 compatibility (same as errorSignal)
Stefan Vogel <sv@exept.de>
parents: 3159
diff changeset
   318
1788
0c71ba975d34 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1780
diff changeset
   319
!Object class methodsFor:'Signal constants'!
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   320
5706
9c49e9b54c45 added AbortAllSignal
Claus Gittinger <cg@exept.de>
parents: 5686
diff changeset
   321
abortAllSignal 
9c49e9b54c45 added AbortAllSignal
Claus Gittinger <cg@exept.de>
parents: 5686
diff changeset
   322
    "return the signal used to abort user actions (much like AbortSignal).
9c49e9b54c45 added AbortAllSignal
Claus Gittinger <cg@exept.de>
parents: 5686
diff changeset
   323
     This signal is supposed to abort multiple operation actions, and get out of
9c49e9b54c45 added AbortAllSignal
Claus Gittinger <cg@exept.de>
parents: 5686
diff changeset
   324
     the loop (such as when confirming multiple class deletions etc.)"
9c49e9b54c45 added AbortAllSignal
Claus Gittinger <cg@exept.de>
parents: 5686
diff changeset
   325
9c49e9b54c45 added AbortAllSignal
Claus Gittinger <cg@exept.de>
parents: 5686
diff changeset
   326
    ^ AbortAllSignal
9c49e9b54c45 added AbortAllSignal
Claus Gittinger <cg@exept.de>
parents: 5686
diff changeset
   327
!
9c49e9b54c45 added AbortAllSignal
Claus Gittinger <cg@exept.de>
parents: 5686
diff changeset
   328
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   329
abortSignal 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   330
    "return the signal used to abort user actions. This signal is only
2689
ada9b102abcf typo fix
Claus Gittinger <cg@exept.de>
parents: 2673
diff changeset
   331
     raised if caught (by the debugger), and will lead way out of the
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   332
     currently active doIt/printIt or inspectIt. (also some others use
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   333
     this for a save abort)"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   334
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   335
    ^ AbortSignal
579
2d26193415b5 allow catching of information: and warn: boxes
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   336
!
2d26193415b5 allow catching of information: and warn: boxes
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   337
782
86f091b2635e activityNotification added
Claus Gittinger <cg@exept.de>
parents: 781
diff changeset
   338
activityNotificationSignal
86f091b2635e activityNotification added
Claus Gittinger <cg@exept.de>
parents: 781
diff changeset
   339
    "return the signal used for activity notifications.
86f091b2635e activityNotification added
Claus Gittinger <cg@exept.de>
parents: 781
diff changeset
   340
     A handler for this signal gets all #activityNotification: sends"
86f091b2635e activityNotification added
Claus Gittinger <cg@exept.de>
parents: 781
diff changeset
   341
86f091b2635e activityNotification added
Claus Gittinger <cg@exept.de>
parents: 781
diff changeset
   342
    ^ ActivityNotificationSignal
86f091b2635e activityNotification added
Claus Gittinger <cg@exept.de>
parents: 781
diff changeset
   343
!
86f091b2635e activityNotification added
Claus Gittinger <cg@exept.de>
parents: 781
diff changeset
   344
159
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
   345
deepCopyErrorSignal 
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
   346
    "return the signal raised when a deepcopy is asked for
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
   347
     an object which cannot do this (for example, BlockClosures
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
   348
     or Contexts)."
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
   349
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
   350
    ^ DeepCopyErrorSignal
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
   351
!
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
   352
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   353
elementOutOfBoundsSignal
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   354
    "return the signal used for element error reporting
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   355
     (this signal is used for example when a value not in 0..255 is to
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   356
      be put into a bytearray)"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   357
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   358
    ^ ElementOutOfBoundsSignal
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   359
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   360
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   361
errorSignal
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   362
    "return the signal used for error/error: - handling"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   363
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   364
    ^ ErrorSignal
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   365
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   366
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   367
exceptionInterruptSignal
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   368
    "return the signal used for exception (display errors) error handling"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   369
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   370
    ^ ExceptionInterruptSignal
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   371
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   372
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   373
haltSignal
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   374
    "return the signal used for halt/halt: - handling"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   375
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   376
    ^ HaltSignal
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   377
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   378
3101
6bb441e14a95 added indexNotFoundSignal (ST80 compat)
Claus Gittinger <cg@exept.de>
parents: 3078
diff changeset
   379
indexNotFoundSignal
6bb441e14a95 added indexNotFoundSignal (ST80 compat)
Claus Gittinger <cg@exept.de>
parents: 3078
diff changeset
   380
    "return the signal used for bad index error reporting.
6bb441e14a95 added indexNotFoundSignal (ST80 compat)
Claus Gittinger <cg@exept.de>
parents: 3078
diff changeset
   381
     This is also the parentSignal of the nonIntegerIndex- and
6bb441e14a95 added indexNotFoundSignal (ST80 compat)
Claus Gittinger <cg@exept.de>
parents: 3078
diff changeset
   382
     subscriptOutOfBoundsSignal"
6bb441e14a95 added indexNotFoundSignal (ST80 compat)
Claus Gittinger <cg@exept.de>
parents: 3078
diff changeset
   383
6bb441e14a95 added indexNotFoundSignal (ST80 compat)
Claus Gittinger <cg@exept.de>
parents: 3078
diff changeset
   384
    ^ IndexNotFoundSignal
6bb441e14a95 added indexNotFoundSignal (ST80 compat)
Claus Gittinger <cg@exept.de>
parents: 3078
diff changeset
   385
6bb441e14a95 added indexNotFoundSignal (ST80 compat)
Claus Gittinger <cg@exept.de>
parents: 3078
diff changeset
   386
    "Created: / 8.11.1997 / 19:15:48 / cg"
6bb441e14a95 added indexNotFoundSignal (ST80 compat)
Claus Gittinger <cg@exept.de>
parents: 3078
diff changeset
   387
!
6bb441e14a95 added indexNotFoundSignal (ST80 compat)
Claus Gittinger <cg@exept.de>
parents: 3078
diff changeset
   388
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   389
informationSignal 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   390
    "return the signal used for informations. 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   391
     A handler for this signal gets all #information: sends"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   392
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   393
    ^ InformationSignal
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   394
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   395
2227
eb1e28c62f14 use an extra signal for internal errors
Claus Gittinger <cg@exept.de>
parents: 2209
diff changeset
   396
internalErrorSignal
eb1e28c62f14 use an extra signal for internal errors
Claus Gittinger <cg@exept.de>
parents: 2209
diff changeset
   397
    "return the signal used to report internal (VM-) errors."
eb1e28c62f14 use an extra signal for internal errors
Claus Gittinger <cg@exept.de>
parents: 2209
diff changeset
   398
eb1e28c62f14 use an extra signal for internal errors
Claus Gittinger <cg@exept.de>
parents: 2209
diff changeset
   399
    ^ InternalErrorSignal
eb1e28c62f14 use an extra signal for internal errors
Claus Gittinger <cg@exept.de>
parents: 2209
diff changeset
   400
!
eb1e28c62f14 use an extra signal for internal errors
Claus Gittinger <cg@exept.de>
parents: 2209
diff changeset
   401
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   402
keyNotFoundSignal 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   403
    "return the signal used for no such key error reporting"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   404
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   405
    ^ KeyNotFoundSignal
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   406
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   407
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   408
messageNotUnderstoodSignal
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   409
    "return the signal used for doesNotUnderstand: - error handling"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   410
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   411
    ^ MessageNotUnderstoodSignal
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   412
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   413
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   414
nonIntegerIndexSignal 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   415
    "return the signal used for bad subscript error reporting"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   416
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   417
    ^ NonIntegerIndexSignal
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   418
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   419
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   420
notFoundSignal 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   421
    "return the signal used for no element found error reporting"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   422
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   423
    ^ NotFoundSignal
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   424
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   425
3423
b4a43b4f098b new signal: osSignalInterruptSignal;
Claus Gittinger <cg@exept.de>
parents: 3418
diff changeset
   426
osSignalInterruptSignal 
b4a43b4f098b new signal: osSignalInterruptSignal;
Claus Gittinger <cg@exept.de>
parents: 3418
diff changeset
   427
    "return the signal used for OS-signal error reporting;
b4a43b4f098b new signal: osSignalInterruptSignal;
Claus Gittinger <cg@exept.de>
parents: 3418
diff changeset
   428
     This is only raised if handled - otherwise, a debugger is entered."
b4a43b4f098b new signal: osSignalInterruptSignal;
Claus Gittinger <cg@exept.de>
parents: 3418
diff changeset
   429
3557
b7eb2a1cb593 oops OSSignalInterruptSignal
Claus Gittinger <cg@exept.de>
parents: 3466
diff changeset
   430
    ^ OSSignalInterruptSignal
b7eb2a1cb593 oops OSSignalInterruptSignal
Claus Gittinger <cg@exept.de>
parents: 3466
diff changeset
   431
b7eb2a1cb593 oops OSSignalInterruptSignal
Claus Gittinger <cg@exept.de>
parents: 3466
diff changeset
   432
    "Modified: / 12.6.1998 / 16:27:26 / cg"
3423
b4a43b4f098b new signal: osSignalInterruptSignal;
Claus Gittinger <cg@exept.de>
parents: 3418
diff changeset
   433
!
b4a43b4f098b new signal: osSignalInterruptSignal;
Claus Gittinger <cg@exept.de>
parents: 3418
diff changeset
   434
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   435
primitiveFailureSignal
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   436
    "return the signal used for primitiveFailed - error handling"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   437
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   438
    ^ PrimitiveFailureSignal
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   439
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   440
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   441
privateMethodSignal
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   442
    "return the signal used for privateMethod - error handling"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   443
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   444
    ^ MessageNotUnderstoodSignal
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   445
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   446
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   447
recursionInterruptSignal 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   448
    "return the signal used for recursion overflow error handling"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   449
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   450
    ^ RecursionInterruptSignal
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   451
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   452
5498
489dc2e6bd4f RecursiveStoreStringSignal lifted to Object
tm
parents: 5495
diff changeset
   453
recursiveStoreStringSignal
489dc2e6bd4f RecursiveStoreStringSignal lifted to Object
tm
parents: 5495
diff changeset
   454
    "return the query signal used to report storeString generation of recursive objects"
489dc2e6bd4f RecursiveStoreStringSignal lifted to Object
tm
parents: 5495
diff changeset
   455
489dc2e6bd4f RecursiveStoreStringSignal lifted to Object
tm
parents: 5495
diff changeset
   456
    ^ RecursiveStoreStringSignal
489dc2e6bd4f RecursiveStoreStringSignal lifted to Object
tm
parents: 5495
diff changeset
   457
489dc2e6bd4f RecursiveStoreStringSignal lifted to Object
tm
parents: 5495
diff changeset
   458
    "
489dc2e6bd4f RecursiveStoreStringSignal lifted to Object
tm
parents: 5495
diff changeset
   459
     Object recursiveStoreStringSignal handle:[:ex |
489dc2e6bd4f RecursiveStoreStringSignal lifted to Object
tm
parents: 5495
diff changeset
   460
        self halt
489dc2e6bd4f RecursiveStoreStringSignal lifted to Object
tm
parents: 5495
diff changeset
   461
     ] do:[
489dc2e6bd4f RecursiveStoreStringSignal lifted to Object
tm
parents: 5495
diff changeset
   462
        |a|
489dc2e6bd4f RecursiveStoreStringSignal lifted to Object
tm
parents: 5495
diff changeset
   463
489dc2e6bd4f RecursiveStoreStringSignal lifted to Object
tm
parents: 5495
diff changeset
   464
        a := Array new:1.
489dc2e6bd4f RecursiveStoreStringSignal lifted to Object
tm
parents: 5495
diff changeset
   465
        a at:1 put:a.
489dc2e6bd4f RecursiveStoreStringSignal lifted to Object
tm
parents: 5495
diff changeset
   466
        a storeOn:Transcript
489dc2e6bd4f RecursiveStoreStringSignal lifted to Object
tm
parents: 5495
diff changeset
   467
     ]
489dc2e6bd4f RecursiveStoreStringSignal lifted to Object
tm
parents: 5495
diff changeset
   468
    "
489dc2e6bd4f RecursiveStoreStringSignal lifted to Object
tm
parents: 5495
diff changeset
   469
489dc2e6bd4f RecursiveStoreStringSignal lifted to Object
tm
parents: 5495
diff changeset
   470
    "
489dc2e6bd4f RecursiveStoreStringSignal lifted to Object
tm
parents: 5495
diff changeset
   471
     |a|
489dc2e6bd4f RecursiveStoreStringSignal lifted to Object
tm
parents: 5495
diff changeset
   472
489dc2e6bd4f RecursiveStoreStringSignal lifted to Object
tm
parents: 5495
diff changeset
   473
     a := Array new:1.
489dc2e6bd4f RecursiveStoreStringSignal lifted to Object
tm
parents: 5495
diff changeset
   474
     a at:1 put:a.
489dc2e6bd4f RecursiveStoreStringSignal lifted to Object
tm
parents: 5495
diff changeset
   475
     a storeOn:Transcript
489dc2e6bd4f RecursiveStoreStringSignal lifted to Object
tm
parents: 5495
diff changeset
   476
    "
489dc2e6bd4f RecursiveStoreStringSignal lifted to Object
tm
parents: 5495
diff changeset
   477
489dc2e6bd4f RecursiveStoreStringSignal lifted to Object
tm
parents: 5495
diff changeset
   478
489dc2e6bd4f RecursiveStoreStringSignal lifted to Object
tm
parents: 5495
diff changeset
   479
489dc2e6bd4f RecursiveStoreStringSignal lifted to Object
tm
parents: 5495
diff changeset
   480
!
489dc2e6bd4f RecursiveStoreStringSignal lifted to Object
tm
parents: 5495
diff changeset
   481
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   482
subscriptOutOfBoundsSignal
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   483
    "return the signal used for subscript error reporting.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   484
     (this signal is used for example when an array is accessed with an
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   485
      index less than 1 or greater than the array size)"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   486
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   487
    ^ SubscriptOutOfBoundsSignal
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   488
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   489
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   490
userInterruptSignal
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   491
    "return the signal used for ^C interrupts handling"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   492
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   493
    ^ UserInterruptSignal
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   494
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   495
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   496
userNotificationSignal
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   497
    "the parent signal used with information and warnings.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   498
     Handling this allows handling of both information- and warning notifications."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   499
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   500
    ^ UserNotificationSignal
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   501
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   502
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   503
warningSignal 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   504
    "return the signal used for warnings.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   505
     A handler for this signal gets all #warn: sends"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   506
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   507
    ^ WarningSignal
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   508
! !
a27a279701f8 Initial revision
claus
parents:
diff changeset
   509
1788
0c71ba975d34 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1780
diff changeset
   510
!Object class methodsFor:'info messages'!
356
claus
parents: 348
diff changeset
   511
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   512
infoPrinting
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   513
    "return the flag which controls information messages."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   514
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   515
    ^ InfoPrinting
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   516
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   517
356
claus
parents: 348
diff changeset
   518
infoPrinting:aBoolean
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
   519
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
   520
356
claus
parents: 348
diff changeset
   521
    "turn on/off printing of information messages.
claus
parents: 348
diff changeset
   522
     If the argument, aBoolean is false, infoPrint will not output
claus
parents: 348
diff changeset
   523
     messages. The default is true."
claus
parents: 348
diff changeset
   524
claus
parents: 348
diff changeset
   525
    InfoPrinting := aBoolean
claus
parents: 348
diff changeset
   526
! !
claus
parents: 348
diff changeset
   527
1788
0c71ba975d34 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1780
diff changeset
   528
!Object class methodsFor:'queries'!
3
24d81bf47225 *** empty log message ***
claus
parents: 2
diff changeset
   529
24d81bf47225 *** empty log message ***
claus
parents: 2
diff changeset
   530
isBuiltInClass
49
f1c2d75f2eb6 *** empty log message ***
claus
parents: 44
diff changeset
   531
    "return true, if this class is known by the run-time-system,
f1c2d75f2eb6 *** empty log message ***
claus
parents: 44
diff changeset
   532
     i.e. you cannot add/remove instance variables without recompiling
1266
cef9b3cd49df commentary
Claus Gittinger <cg@exept.de>
parents: 1260
diff changeset
   533
     the VM.
cef9b3cd49df commentary
Claus Gittinger <cg@exept.de>
parents: 1260
diff changeset
   534
     Here, true is returned for myself, false for subclasses."
3
24d81bf47225 *** empty log message ***
claus
parents: 2
diff changeset
   535
24d81bf47225 *** empty log message ***
claus
parents: 2
diff changeset
   536
    ^ self == Object
1266
cef9b3cd49df commentary
Claus Gittinger <cg@exept.de>
parents: 1260
diff changeset
   537
cef9b3cd49df commentary
Claus Gittinger <cg@exept.de>
parents: 1260
diff changeset
   538
    "Modified: 23.4.1996 / 16:00:07 / cg"
3
24d81bf47225 *** empty log message ***
claus
parents: 2
diff changeset
   539
! !
24d81bf47225 *** empty log message ***
claus
parents: 2
diff changeset
   540
5307
568d242fcf3a VW5i compatibility
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
   541
!Object methodsFor:'Compatibility - ST80'!
568d242fcf3a VW5i compatibility
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
   542
568d242fcf3a VW5i compatibility
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
   543
isMetaclass
568d242fcf3a VW5i compatibility
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
   544
    ^ self isMeta
568d242fcf3a VW5i compatibility
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
   545
! !
568d242fcf3a VW5i compatibility
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
   546
4858
8f3ed29a8fe0 quicker 0-return from float- and doubleArray
Claus Gittinger <cg@exept.de>
parents: 4818
diff changeset
   547
!Object methodsFor:'Compatibility - Squeak'!
4587
58c780c70318 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4574
diff changeset
   548
5627
0fa89483a8ab added #as: (Squeak compatibility)
Claus Gittinger <cg@exept.de>
parents: 5622
diff changeset
   549
as: aSimilarClass
0fa89483a8ab added #as: (Squeak compatibility)
Claus Gittinger <cg@exept.de>
parents: 5622
diff changeset
   550
    "Create an object of class aSimilarClass that has similar contents to the receiver."
0fa89483a8ab added #as: (Squeak compatibility)
Claus Gittinger <cg@exept.de>
parents: 5622
diff changeset
   551
0fa89483a8ab added #as: (Squeak compatibility)
Claus Gittinger <cg@exept.de>
parents: 5622
diff changeset
   552
    ^ aSimilarClass newFrom:self
0fa89483a8ab added #as: (Squeak compatibility)
Claus Gittinger <cg@exept.de>
parents: 5622
diff changeset
   553
0fa89483a8ab added #as: (Squeak compatibility)
Claus Gittinger <cg@exept.de>
parents: 5622
diff changeset
   554
    "
0fa89483a8ab added #as: (Squeak compatibility)
Claus Gittinger <cg@exept.de>
parents: 5622
diff changeset
   555
     #[1 2 3 4] as:ByteArray
0fa89483a8ab added #as: (Squeak compatibility)
Claus Gittinger <cg@exept.de>
parents: 5622
diff changeset
   556
    "
0fa89483a8ab added #as: (Squeak compatibility)
Claus Gittinger <cg@exept.de>
parents: 5622
diff changeset
   557
!
0fa89483a8ab added #as: (Squeak compatibility)
Claus Gittinger <cg@exept.de>
parents: 5622
diff changeset
   558
4991
b326c2cfe076 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4982
diff changeset
   559
asString
b326c2cfe076 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4982
diff changeset
   560
    ^ self printString
b326c2cfe076 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4982
diff changeset
   561
!
b326c2cfe076 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4982
diff changeset
   562
4587
58c780c70318 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4574
diff changeset
   563
clone
58c780c70318 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4574
diff changeset
   564
    ^ self shallowCopy
4982
adfc8977cee4 more Squeak compatibility
ps
parents: 4884
diff changeset
   565
!
adfc8977cee4 more Squeak compatibility
ps
parents: 4884
diff changeset
   566
4991
b326c2cfe076 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4982
diff changeset
   567
currentHand
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
   568
        "Return a usable HandMorph -- the one associated with the object's current environment.  This method will always return a hand, even if it has to conjure one up as a last resort.  If a particular hand is actually handling events at the moment (such as a remote hand or a ghost hand), it will be returned."
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
   569
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
   570
        | w |
5706
9c49e9b54c45 added AbortAllSignal
Claus Gittinger <cg@exept.de>
parents: 5686
diff changeset
   571
        ^ (w _ self currentWorld) activeHand ifNil: [w hands first]
9c49e9b54c45 added AbortAllSignal
Claus Gittinger <cg@exept.de>
parents: 5686
diff changeset
   572
!
4991
b326c2cfe076 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4982
diff changeset
   573
b326c2cfe076 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4982
diff changeset
   574
currentWorld
b326c2cfe076 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4982
diff changeset
   575
        ^ Utilities currentWorld
b326c2cfe076 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4982
diff changeset
   576
!
b326c2cfe076 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4982
diff changeset
   577
b326c2cfe076 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4982
diff changeset
   578
newTileMorphRepresentative
5706
9c49e9b54c45 added AbortAllSignal
Claus Gittinger <cg@exept.de>
parents: 5686
diff changeset
   579
        ^ TileMorph new setLiteral: self
9c49e9b54c45 added AbortAllSignal
Claus Gittinger <cg@exept.de>
parents: 5686
diff changeset
   580
!
4991
b326c2cfe076 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4982
diff changeset
   581
b326c2cfe076 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4982
diff changeset
   582
stringForReadout
5706
9c49e9b54c45 added AbortAllSignal
Claus Gittinger <cg@exept.de>
parents: 5686
diff changeset
   583
        ^ self stringRepresentation
9c49e9b54c45 added AbortAllSignal
Claus Gittinger <cg@exept.de>
parents: 5686
diff changeset
   584
!
4991
b326c2cfe076 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4982
diff changeset
   585
b326c2cfe076 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4982
diff changeset
   586
stringRepresentation
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
   587
        "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"
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
   588
5706
9c49e9b54c45 added AbortAllSignal
Claus Gittinger <cg@exept.de>
parents: 5686
diff changeset
   589
        ^ self printString 
9c49e9b54c45 added AbortAllSignal
Claus Gittinger <cg@exept.de>
parents: 5686
diff changeset
   590
!
4991
b326c2cfe076 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4982
diff changeset
   591
4982
adfc8977cee4 more Squeak compatibility
ps
parents: 4884
diff changeset
   592
veryDeepCopy
adfc8977cee4 more Squeak compatibility
ps
parents: 4884
diff changeset
   593
adfc8977cee4 more Squeak compatibility
ps
parents: 4884
diff changeset
   594
     ^(self deepCopyUsing:(IdentityDictionary new)) postDeepCopyFrom:self
4587
58c780c70318 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4574
diff changeset
   595
! !
58c780c70318 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4574
diff changeset
   596
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   597
!Object methodsFor:'accessing'!
a27a279701f8 Initial revision
claus
parents:
diff changeset
   598
a27a279701f8 Initial revision
claus
parents:
diff changeset
   599
at:index
a27a279701f8 Initial revision
claus
parents:
diff changeset
   600
    "return the indexed instance variable with index, anInteger;
a27a279701f8 Initial revision
claus
parents:
diff changeset
   601
     this method can be redefined in subclasses."
a27a279701f8 Initial revision
claus
parents:
diff changeset
   602
a27a279701f8 Initial revision
claus
parents:
diff changeset
   603
    ^ self basicAt:index
a27a279701f8 Initial revision
claus
parents:
diff changeset
   604
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
   605
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   606
at:index put:anObject
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   607
    "store the 2nd arg, anObject as indexed instvar with index, anInteger.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   608
     this method can be redefined in subclasses. Returns anObject (sigh)"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   609
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   610
    ^ self basicAt:index put:anObject
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   611
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   612
    "Modified: 19.4.1996 / 11:13:29 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   613
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   614
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   615
basicAt:index
a27a279701f8 Initial revision
claus
parents:
diff changeset
   616
    "return the indexed instance variable with index, anInteger.
a27a279701f8 Initial revision
claus
parents:
diff changeset
   617
     Trigger an error if the receiver has no indexed instance variables.
2148
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   618
     This method should NOT be redefined in any subclass (except with great care, for tuning)"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   619
a27a279701f8 Initial revision
claus
parents:
diff changeset
   620
%{  /* NOCONTEXT */
a27a279701f8 Initial revision
claus
parents:
diff changeset
   621
329
claus
parents: 325
diff changeset
   622
    REGISTER int nbytes, indx;
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   623
    OBJ myClass;
329
claus
parents: 325
diff changeset
   624
    REGISTER char *pFirst;
3159
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   625
#ifdef alpha64
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
   626
#   define int32        int
3159
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   627
#else
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
   628
#   define int32        long
3159
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   629
#endif
329
claus
parents: 325
diff changeset
   630
    REGISTER int n;
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   631
a27a279701f8 Initial revision
claus
parents:
diff changeset
   632
    /*
56
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
   633
     * notice the missing test for self being a nonNilObject -
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   634
     * this can be done since basicAt: is defined both in UndefinedObject
a27a279701f8 Initial revision
claus
parents:
diff changeset
   635
     * and SmallInteger
a27a279701f8 Initial revision
claus
parents:
diff changeset
   636
     */
253
30daee717a53 *** empty log message ***
claus
parents: 228
diff changeset
   637
    if (__isSmallInteger(index)) {
4220
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   638
        myClass = __qClass(self);
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   639
        indx = __intVal(index) - 1;
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   640
        n /* nInstVars */ = __intVal(__ClassInstPtr(myClass)->c_ninstvars);
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   641
        n /* nInstBytes */ = OHDR_SIZE + __OBJS2BYTES__(n /* nInstVars */);
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   642
        nbytes = __qSize(self) - n /* nInstBytes */;
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   643
        pFirst = (char *)(__InstPtr(self)) + n /* nInstBytes */;
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   644
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   645
        switch ((INT)(__ClassInstPtr(myClass)->c_flags) & __MASKSMALLINT(ARRAYMASK)) {
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   646
            case __MASKSMALLINT(POINTERARRAY):
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   647
            case __MASKSMALLINT(WKPOINTERARRAY):
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   648
                /*
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   649
                 * pointers
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   650
                 */
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   651
                if ((unsigned)indx < (__BYTES2OBJS__(nbytes))) {
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   652
                    OBJ *op;
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   653
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   654
                    op = (OBJ *)pFirst + indx;
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   655
                    RETURN ( *op );
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   656
                }
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   657
                break;
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   658
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   659
            case __MASKSMALLINT(BYTEARRAY):
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   660
                /*
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   661
                 * (unsigned) bytes
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   662
                 */
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   663
                if ((unsigned)indx < nbytes) {
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   664
                    unsigned char *cp;
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   665
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   666
                    cp = (unsigned char *)pFirst + indx;
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   667
                    RETURN ( __MKSMALLINT(*cp & 0xFF) );
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   668
                }
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   669
                break;
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   670
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   671
            case __MASKSMALLINT(FLOATARRAY):
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   672
                /*
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   673
                 * native floats
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   674
                 */
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   675
                if ((unsigned)indx < (nbytes / sizeof(float))) {
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   676
                    float *fp;
4858
8f3ed29a8fe0 quicker 0-return from float- and doubleArray
Claus Gittinger <cg@exept.de>
parents: 4818
diff changeset
   677
                    float f;
4220
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   678
                    OBJ v;
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   679
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   680
                    fp = (float *)pFirst + indx;
4858
8f3ed29a8fe0 quicker 0-return from float- and doubleArray
Claus Gittinger <cg@exept.de>
parents: 4818
diff changeset
   681
                    f = *fp;
8f3ed29a8fe0 quicker 0-return from float- and doubleArray
Claus Gittinger <cg@exept.de>
parents: 4818
diff changeset
   682
                    if (f == 0.0) {
8f3ed29a8fe0 quicker 0-return from float- and doubleArray
Claus Gittinger <cg@exept.de>
parents: 4818
diff changeset
   683
                        v = __float0;
8f3ed29a8fe0 quicker 0-return from float- and doubleArray
Claus Gittinger <cg@exept.de>
parents: 4818
diff changeset
   684
                    } else {
8f3ed29a8fe0 quicker 0-return from float- and doubleArray
Claus Gittinger <cg@exept.de>
parents: 4818
diff changeset
   685
                        __qMKSFLOAT(v, f);
8f3ed29a8fe0 quicker 0-return from float- and doubleArray
Claus Gittinger <cg@exept.de>
parents: 4818
diff changeset
   686
                    }
4220
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   687
                    RETURN (v);
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   688
                }
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   689
                break;
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   690
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   691
            case __MASKSMALLINT(DOUBLEARRAY):
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   692
                /*
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   693
                 * native doubles
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   694
                 */
3921
8e07cb118aa3 added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents: 3841
diff changeset
   695
#ifdef __NEED_DOUBLE_ALIGN
4220
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   696
                if ((INT)pFirst & (__DOUBLE_ALIGN-1)) {
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   697
                    int delta = __DOUBLE_ALIGN - ((INT)pFirst & (__DOUBLE_ALIGN-1));
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   698
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   699
                    pFirst += delta;
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   700
                    nbytes -= delta;
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   701
                }
3921
8e07cb118aa3 added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents: 3841
diff changeset
   702
#endif
4220
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   703
                if ((unsigned)indx < (nbytes / sizeof(double))) {
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   704
                    double *dp;
4858
8f3ed29a8fe0 quicker 0-return from float- and doubleArray
Claus Gittinger <cg@exept.de>
parents: 4818
diff changeset
   705
                    double d;
4220
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   706
                    OBJ v;
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   707
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   708
                    dp = (double *)pFirst + indx;
4858
8f3ed29a8fe0 quicker 0-return from float- and doubleArray
Claus Gittinger <cg@exept.de>
parents: 4818
diff changeset
   709
                    d = *dp;
8f3ed29a8fe0 quicker 0-return from float- and doubleArray
Claus Gittinger <cg@exept.de>
parents: 4818
diff changeset
   710
                    if (d == 0.0) {
8f3ed29a8fe0 quicker 0-return from float- and doubleArray
Claus Gittinger <cg@exept.de>
parents: 4818
diff changeset
   711
                        v = __float0;
8f3ed29a8fe0 quicker 0-return from float- and doubleArray
Claus Gittinger <cg@exept.de>
parents: 4818
diff changeset
   712
                    } else {
8f3ed29a8fe0 quicker 0-return from float- and doubleArray
Claus Gittinger <cg@exept.de>
parents: 4818
diff changeset
   713
                        __qMKFLOAT(v, d);
8f3ed29a8fe0 quicker 0-return from float- and doubleArray
Claus Gittinger <cg@exept.de>
parents: 4818
diff changeset
   714
                    }
4220
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   715
                    RETURN (v);
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   716
                }
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   717
                break;
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   718
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   719
            case __MASKSMALLINT(WORDARRAY):
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   720
                /*
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   721
                 * unsigned 16bit ints
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   722
                 */
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   723
                /* Notice: the hard coded shifts are by purpose;
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   724
                 * it makes us independent of the short-size of the machine
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   725
                 */
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   726
                if ((unsigned)indx < (nbytes>>1)) {
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   727
                    unsigned short *sp;
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   728
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   729
                    sp = (unsigned short *)(pFirst + (indx<<1));
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   730
                    RETURN ( __MKSMALLINT(*sp & 0xFFFF) );
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   731
                }
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   732
                break;
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   733
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   734
            case __MASKSMALLINT(SWORDARRAY):
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   735
                /*
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   736
                 * signed 16bit ints
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   737
                 */
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   738
                /* Notice: the hard coded shifts are by purpose;
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   739
                 * it makes us independent of the short-size of the machine
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   740
                 */
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   741
                if ((unsigned)indx < (nbytes>>1)) {
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   742
                    short *ssp;
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   743
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   744
                    ssp = (short *)(pFirst + (indx<<1));
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   745
                    RETURN ( __MKSMALLINT(*ssp) );
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   746
                }
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   747
                break;
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   748
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   749
            case __MASKSMALLINT(LONGARRAY):
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   750
                /*
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   751
                 * unsigned 32bit ints
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   752
                 */
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   753
                /* Notice: the hard coded shifts are by purpose;
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   754
                 * it makes us independent of the int-size of the machine
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   755
                 */
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   756
                if ((unsigned)indx < (nbytes>>2)) {
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   757
                    unsigned int32 ul;
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   758
                    unsigned int32 *lp;
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   759
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   760
                    lp = (unsigned int32 *)(pFirst + (indx<<2));
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   761
                    ul = *lp;
3921
8e07cb118aa3 added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents: 3841
diff changeset
   762
#ifdef alpha64
4220
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   763
                    {
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   764
                        unsigned  INT ull = (unsigned INT)ul;
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   765
                        RETURN ( __MKSMALLINT(ull) );
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   766
                    }
3921
8e07cb118aa3 added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents: 3841
diff changeset
   767
#else
4220
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   768
                    if (ul <= _MAX_INT) {
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   769
                        RETURN ( __MKSMALLINT(ul) );
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   770
                    }
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   771
                    RETURN ( __MKULARGEINT(ul) );
3921
8e07cb118aa3 added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents: 3841
diff changeset
   772
#endif
4220
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   773
                }
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   774
                break;
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   775
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   776
            case __MASKSMALLINT(SLONGARRAY):
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   777
                /*
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   778
                 * signed 32bit ints
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   779
                 */
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   780
                /* Notice: the hard coded shifts are by purpose;
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   781
                 * it makes us independent of the int-size of the machine
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   782
                 */
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   783
                if ((unsigned)indx < (nbytes>>2)) {
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   784
                    int32 *slp;
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   785
                    int32 l;
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   786
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   787
                    slp = (int32 *)(pFirst + (indx<<2));
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   788
                    l = *slp;
3921
8e07cb118aa3 added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents: 3841
diff changeset
   789
#ifdef alpha64
4220
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   790
                    {
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   791
                        INT ll = (INT)l;
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   792
                        RETURN ( __MKSMALLINT(ll) );
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   793
                    }
3921
8e07cb118aa3 added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents: 3841
diff changeset
   794
#else
4220
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   795
                    if (__ISVALIDINTEGER(l)) {
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   796
                        RETURN ( __MKSMALLINT(l) );
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   797
                    }
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   798
                    RETURN ( __MKLARGEINT(l) );
3921
8e07cb118aa3 added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents: 3841
diff changeset
   799
#endif
4220
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   800
                }
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   801
                break;
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   802
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   803
            case __MASKSMALLINT(SLONGLONGARRAY):
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   804
                /*
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   805
                 * signed 64bit longlongs
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   806
                 */
3921
8e07cb118aa3 added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents: 3841
diff changeset
   807
#ifdef __NEED_LONGLONG_ALIGN
4220
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   808
                if ((INT)pFirst & (__LONGLONG_ALIGN-1)) {
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   809
                    int delta = __LONGLONG_ALIGN - ((INT)pFirst & (__LONGLONG_ALIGN-1));
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   810
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   811
                    pFirst += delta;
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   812
                    nbytes -= delta;
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   813
                }
3921
8e07cb118aa3 added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents: 3841
diff changeset
   814
#endif
4220
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   815
                /* Notice: the hard coded shifts are by purpose;
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   816
                 * it makes us independent of the long/longlong-size of the machine
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   817
                 */
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   818
                if ((unsigned)indx < (nbytes>>3)) {
3921
8e07cb118aa3 added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents: 3841
diff changeset
   819
#ifdef alpha64
4220
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   820
                    INT *slp, ll;
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   821
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   822
                    slp = (INT *)(pFirst + (indx<<3));
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   823
                    ll = *slp;
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   824
                    if (__ISVALIDINTEGER(ll)) {
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   825
                        RETURN ( __MKSMALLINT(ll) );
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   826
                    }
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   827
                    RETURN ( __MKLARGEINT(ll) );
3921
8e07cb118aa3 added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents: 3841
diff changeset
   828
#else
4220
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   829
                    __int64__ *llp;
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   830
                    extern OBJ __MKINT64();
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   831
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   832
                    llp = (__int64__ *)(pFirst + (indx<<3));
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   833
                    RETURN (__MKINT64(llp));
3921
8e07cb118aa3 added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents: 3841
diff changeset
   834
#endif
4220
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   835
                }
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   836
                break;
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   837
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   838
            case __MASKSMALLINT(LONGLONGARRAY):
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   839
                /*
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   840
                 * unsigned 64bit longlongs
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   841
                 */
3921
8e07cb118aa3 added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents: 3841
diff changeset
   842
#ifdef __NEED_LONGLONG_ALIGN
4220
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   843
                if ((INT)pFirst & (__LONGLONG_ALIGN-1)) {
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   844
                    int delta = __LONGLONG_ALIGN - ((INT)pFirst & (__LONGLONG_ALIGN-1));
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   845
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   846
                    pFirst += delta;
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   847
                    nbytes -= delta;
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   848
                }
3921
8e07cb118aa3 added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents: 3841
diff changeset
   849
#endif
4220
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   850
                /* Notice: the hard coded shifts are by purpose;
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   851
                 * it makes us independent of the long/longlong-size of the machine
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   852
                 */
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   853
                if ((unsigned)indx < (nbytes>>3)) {
3921
8e07cb118aa3 added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents: 3841
diff changeset
   854
#ifdef alpha64
4220
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   855
                    unsigned INT *ulp, ul;
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   856
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   857
                    ulp = (unsigned INT *)(pFirst + (indx<<3));
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   858
                    ul = *ulp;
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   859
                    if (ul <= _MAX_INT) {
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   860
                        RETURN ( __MKSMALLINT(ul) );
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   861
                    }
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   862
                    RETURN ( __MKULARGEINT(ul) );
3921
8e07cb118aa3 added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents: 3841
diff changeset
   863
#else
4220
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   864
                    __uint64__ *llp;
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   865
                    extern OBJ __MKUINT64();
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   866
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   867
                    llp = (__uint64__ *)(pFirst + (indx<<3));
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   868
                    RETURN (__MKUINT64(llp));
3921
8e07cb118aa3 added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents: 3841
diff changeset
   869
#endif
4220
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   870
                }
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   871
                break;
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   872
        }
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   873
    }
3159
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   874
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   875
#   undef int32
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   876
1386
a31cecccdfd8 _MASKSMALLINT -> __MASKSMALLINT;
Claus Gittinger <cg@exept.de>
parents: 1377
diff changeset
   877
%}.
10
claus
parents: 5
diff changeset
   878
    index isInteger ifFalse:[
4220
f4cbb12b74dd alpha64 fix
Claus Gittinger <cg@exept.de>
parents: 4208
diff changeset
   879
        ^ self indexNotInteger
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   880
    ].
159
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
   881
    ^ self subscriptBoundsError:index
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   882
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
   883
a27a279701f8 Initial revision
claus
parents:
diff changeset
   884
basicAt:index put:anObject
a27a279701f8 Initial revision
claus
parents:
diff changeset
   885
    "store the 2nd arg, anObject as indexed instvar with index, anInteger.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   886
     Returns anObject (sigh).
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   887
     Trigger an error if the receiver has no indexed instance variables.
2148
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   888
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   889
     This method should NOT be redefined in any subclass (except with great care, for tuning)"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   890
a27a279701f8 Initial revision
claus
parents:
diff changeset
   891
%{  /* NOCONTEXT */
a27a279701f8 Initial revision
claus
parents:
diff changeset
   892
a27a279701f8 Initial revision
claus
parents:
diff changeset
   893
    register int nbytes, indx;
a27a279701f8 Initial revision
claus
parents:
diff changeset
   894
    OBJ myClass;
a27a279701f8 Initial revision
claus
parents:
diff changeset
   895
    register char *pFirst;
3159
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   896
#ifdef alpha64
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
   897
#   define int32        int
3159
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   898
#else
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
   899
#   define int32        long
3159
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   900
#endif
329
claus
parents: 325
diff changeset
   901
/*    int nInstBytes, ninstvars, flags; */
claus
parents: 325
diff changeset
   902
    REGISTER int n;
1515
49a8587fcc8f added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents: 1445
diff changeset
   903
    unsigned int u;
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   904
    int val;
a27a279701f8 Initial revision
claus
parents:
diff changeset
   905
56
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
   906
    /* notice the missing test for self being a nonNilObject -
77
6c38ca59927f *** empty log message ***
claus
parents: 71
diff changeset
   907
       this can be done since basicAt: is defined both in UndefinedObject
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   908
       and SmallInteger */
a27a279701f8 Initial revision
claus
parents:
diff changeset
   909
253
30daee717a53 *** empty log message ***
claus
parents: 228
diff changeset
   910
    if (__isSmallInteger(index)) {
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
   911
        indx = __intVal(index) - 1;
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
   912
        myClass = __qClass(self);
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
   913
        n /* ninstvars */ = __intVal(__ClassInstPtr(myClass)->c_ninstvars);
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
   914
        n /* nInstBytes */ = OHDR_SIZE + __OBJS2BYTES__(n /* ninstvars */);
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
   915
        nbytes = __qSize(self) - n /* nInstBytes */;
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
   916
        pFirst = (char *)(__InstPtr(self)) + n /* nInstBytes */;
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
   917
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
   918
        switch ((INT)(__ClassInstPtr(myClass)->c_flags) & __MASKSMALLINT(ARRAYMASK)) {
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
   919
            case __MASKSMALLINT(POINTERARRAY):
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
   920
            case __MASKSMALLINT(WKPOINTERARRAY):
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
   921
                if ((unsigned)indx < (__BYTES2OBJS__(nbytes))) {
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
   922
                    OBJ *op;
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
   923
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
   924
                    op = (OBJ *)pFirst + indx;
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
   925
                    *op = anObject;
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
   926
                    __STORE(self, anObject);
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
   927
                    RETURN ( anObject );
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
   928
                }
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
   929
                break;
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
   930
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
   931
            case __MASKSMALLINT(BYTEARRAY):
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
   932
                if (__isSmallInteger(anObject)) {
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
   933
                    val = __intVal(anObject);
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
   934
                    if ((val & ~0xFF) == 0 /* i.e. (val >= 0) && (val <= 255) */) {
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
   935
                        if ((unsigned)indx < nbytes) {
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
   936
                            char *cp;
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
   937
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
   938
                            cp = pFirst + indx;
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
   939
                            *cp = val;
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
   940
                            RETURN ( anObject );
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
   941
                        }
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
   942
                    }
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
   943
                }
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
   944
                break;
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
   945
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
   946
            case __MASKSMALLINT(FLOATARRAY):
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
   947
                if ((unsigned)indx < (nbytes / sizeof(float))) {
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
   948
                    float *fp;
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
   949
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
   950
                    fp = (float *)pFirst + indx;
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
   951
                    if (anObject != nil) {
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
   952
                        if (! __isSmallInteger(anObject)) {
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
   953
                            if (__qIsFloatLike(anObject)) {
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
   954
                                *fp = (float)(__floatVal(anObject));
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
   955
                                RETURN ( anObject );
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
   956
                            }
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
   957
                            if (__qIsShortFloat(anObject)) {
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
   958
                                *fp = __shortFloatVal(anObject);
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
   959
                                RETURN ( anObject );
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
   960
                            }
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
   961
                        } else {
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
   962
                            *fp = (float) __intVal(anObject);
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
   963
                            RETURN ( anObject );
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
   964
                        }
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
   965
                    }
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
   966
                }
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
   967
                break;
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
   968
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
   969
            case __MASKSMALLINT(DOUBLEARRAY):
3921
8e07cb118aa3 added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents: 3841
diff changeset
   970
#ifdef __NEED_DOUBLE_ALIGN
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
   971
                if ((INT)pFirst & (__DOUBLE_ALIGN-1)) {
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
   972
                    int delta = __DOUBLE_ALIGN - ((INT)pFirst & (__DOUBLE_ALIGN-1));
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
   973
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
   974
                    pFirst += delta;
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
   975
                    nbytes -= delta;
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
   976
                }
3921
8e07cb118aa3 added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents: 3841
diff changeset
   977
#endif
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
   978
                if ((unsigned)indx < (nbytes / sizeof(double))) {
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
   979
                    double *dp;
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
   980
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
   981
                    dp = (double *)pFirst + indx;
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
   982
                    if (anObject != nil) {
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
   983
                        if (! __isSmallInteger(anObject)) {
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
   984
                            if (__qIsFloatLike(anObject)) {
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
   985
                                *dp = __floatVal(anObject);
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
   986
                                RETURN ( anObject );
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
   987
                            }
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
   988
                            if (__qIsShortFloat(anObject)) {
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
   989
                                *dp = (double)__shortFloatVal(anObject);
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
   990
                                RETURN ( anObject );
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
   991
                            }
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
   992
                        } else {
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
   993
                            *dp = (double) __intVal(anObject);
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
   994
                            RETURN ( anObject );
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
   995
                        }
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
   996
                    }
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
   997
                }
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
   998
                break;
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
   999
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1000
            case __MASKSMALLINT(WORDARRAY):
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1001
                if (__isSmallInteger(anObject)) {
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1002
                    val = __intVal(anObject);
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1003
                    if ((unsigned)val <= 0xFFFF) {
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1004
                        if ((unsigned)indx < (nbytes>>1)) {
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1005
                            unsigned short *sp;
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1006
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1007
                            sp = (unsigned short *)(pFirst + (indx<<1));
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1008
                            *sp = val;
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1009
                            RETURN ( anObject );
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1010
                        }
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1011
                    }
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1012
                }
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1013
                break;
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1014
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1015
            case __MASKSMALLINT(SWORDARRAY):
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1016
                if (__isSmallInteger(anObject)) {
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1017
                    val = __intVal(anObject);
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1018
                    if ((val >= -32768) && (val < 32768)) {
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1019
                        if ((unsigned)indx < (nbytes>>1)) {
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1020
                            short *ssp;
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1021
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1022
                            ssp = (short *)(pFirst + (indx<<1));
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1023
                            *ssp = val;
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1024
                            RETURN ( anObject );
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1025
                        }
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1026
                    }
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1027
                }
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1028
                break;
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1029
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1030
            case __MASKSMALLINT(SLONGARRAY):
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1031
                if ((unsigned)indx < (nbytes>>2)) {
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1032
                    int32 *slp;
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1033
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1034
                    slp = (int32 *)(pFirst + (indx<<2));
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1035
                    if (__isSmallInteger(anObject)) {
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1036
                        *slp = __intVal(anObject);
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1037
                        RETURN ( anObject );
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1038
                    }
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1039
                    n = __signedLongIntVal(anObject);
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1040
                    /*
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1041
                     * zero means failure for an int larger than 4 bytes 
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1042
                     * (would be a smallInteger) 
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1043
                     */
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1044
                    if (n) {
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1045
                        *slp = n;
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1046
                        RETURN ( anObject );
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1047
                    }
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1048
                }
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1049
                break;
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1050
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1051
            case __MASKSMALLINT(LONGARRAY):
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1052
                if ((unsigned)indx < (nbytes>>2)) {
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1053
                    unsigned int32 *lp;
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1054
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1055
                    lp = (unsigned int32 *)(pFirst + (indx<<2));
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1056
                    if (anObject == __MKSMALLINT(0)) {
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1057
                        *lp = 0;
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1058
                        RETURN ( anObject );
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1059
                    }
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1060
                    u = __longIntVal(anObject);
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1061
                    /*
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1062
                     * zero means failure for an int larger than 4 bytes
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1063
                     * (would be a smallInteger)
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1064
                     */
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1065
                    if (u) {
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1066
                        *lp = u;
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1067
                        RETURN ( anObject );
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1068
                    }
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1069
                }
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1070
                break;
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1071
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1072
            case __MASKSMALLINT(SLONGLONGARRAY):
3921
8e07cb118aa3 added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents: 3841
diff changeset
  1073
#ifdef __NEED_LONGLONG_ALIGN
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1074
                if ((INT)pFirst & (__LONGLONG_ALIGN-1)) {
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1075
                    int delta = __LONGLONG_ALIGN - ((INT)pFirst & (__LONGLONG_ALIGN-1));
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1076
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1077
                    pFirst += delta;
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1078
                    nbytes -= delta;
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1079
                }
3921
8e07cb118aa3 added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents: 3841
diff changeset
  1080
#endif
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1081
                if ((unsigned)indx < (nbytes>>3)) {
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1082
                    __int64__ ll;
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1083
                    __int64__ *sllp;
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1084
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1085
                    sllp = (__int64__ *)(pFirst + (indx<<3));
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1086
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1087
                    if (anObject == __MKSMALLINT(0)) {
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1088
                        ll.lo = ll.hi = 0;
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1089
                        *sllp = ll;
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1090
                        RETURN ( anObject );
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1091
                    }
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1092
                    if (__signedLong64IntVal(anObject, &ll)) {
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1093
                        *sllp = ll;
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1094
                        RETURN ( anObject );
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1095
                    }
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1096
                }
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1097
                break;
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1098
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1099
            case __MASKSMALLINT(LONGLONGARRAY):
3921
8e07cb118aa3 added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents: 3841
diff changeset
  1100
#ifdef __NEED_LONGLONG_ALIGN
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1101
                if ((INT)pFirst & (__LONGLONG_ALIGN-1)) {
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1102
                    int delta = __LONGLONG_ALIGN - ((INT)pFirst & (__LONGLONG_ALIGN-1));
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1103
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1104
                    pFirst += delta;
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1105
                    nbytes -= delta;
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1106
                }
3921
8e07cb118aa3 added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents: 3841
diff changeset
  1107
#endif
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1108
                if ((unsigned)indx < (nbytes>>3)) {
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1109
                    __uint64__ ll;
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1110
                    __uint64__ *llp;
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1111
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1112
                    llp = (__uint64__ *)(pFirst + (indx<<3));
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1113
                    if (anObject == __MKSMALLINT(0)) {
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1114
                        ll.lo = ll.hi = 0;
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1115
                        *llp = ll;
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1116
                        RETURN ( anObject );
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1117
                    }
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1118
                    if (__unsignedLong64IntVal(anObject, &ll)) {
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1119
                        *llp = ll;
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1120
                        RETURN ( anObject );
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1121
                    }
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1122
                }
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1123
                break;
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1124
        }
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1125
    }
3159
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
  1126
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
  1127
#   undef int32
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
  1128
1386
a31cecccdfd8 _MASKSMALLINT -> __MASKSMALLINT;
Claus Gittinger <cg@exept.de>
parents: 1377
diff changeset
  1129
%}.
10
claus
parents: 5
diff changeset
  1130
    index isInteger ifFalse:[
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1131
        "
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1132
         the index should be an integer number
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1133
        "
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1134
        ^ self indexNotInteger
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1135
    ].
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1136
    (index between:1 and:self size) ifFalse:[
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1137
        "
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1138
         the index is less than 1 or greater than the size of the
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1139
         receiver collection
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1140
        "
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1141
        ^ self subscriptBoundsError:index
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1142
    ].
643
04b2025af0e3 use new isFLoatsOrDoubles
Claus Gittinger <cg@exept.de>
parents: 594
diff changeset
  1143
    (self class isFloatsOrDoubles) ifTrue:[
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1144
        anObject isNumber ifTrue:[
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1145
            ^ self basicAt:index put:(anObject asFloat)
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1146
        ]
13
62303f84ff5f *** empty log message ***
claus
parents: 10
diff changeset
  1147
    ].
10
claus
parents: 5
diff changeset
  1148
    anObject isInteger ifFalse:[
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1149
        "
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1150
         the object to put into the receiver collection
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1151
         should be an integer number
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1152
        "
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1153
        ^ self elementNotInteger
2
claus
parents: 1
diff changeset
  1154
    ].
159
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1155
    "
213
3b56a17534fd *** empty log message ***
claus
parents: 202
diff changeset
  1156
     the object to put into the receiver collection
362
claus
parents: 359
diff changeset
  1157
     is not an instance of the expected element class,
claus
parents: 359
diff changeset
  1158
     or the value is  not within the elements valid range.
159
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1159
    "
2
claus
parents: 1
diff changeset
  1160
    ^ self elementBoundsError
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  1161
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  1162
    "Modified: 19.4.1996 / 11:14:10 / cg"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1163
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1164
2574
3df87ac8838c added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents: 2511
diff changeset
  1165
byteAt:index
3df87ac8838c added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents: 2511
diff changeset
  1166
    "return the byte at index. 
3df87ac8838c added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents: 2511
diff changeset
  1167
     This is only allowed for non-pointer indexed objects
3df87ac8838c added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents: 2511
diff changeset
  1168
     (i.e. byteArrays, wordArrays, floatArrays etc.).
3df87ac8838c added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents: 2511
diff changeset
  1169
     The receivers indexed instvars are treated as an uninterpreted
3df87ac8838c added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents: 2511
diff changeset
  1170
     collection of bytes.
3df87ac8838c added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents: 2511
diff changeset
  1171
     Only useful with binary storage."
3df87ac8838c added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents: 2511
diff changeset
  1172
3df87ac8838c added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents: 2511
diff changeset
  1173
%{  /* NOCONTEXT */
3df87ac8838c added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents: 2511
diff changeset
  1174
3df87ac8838c added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents: 2511
diff changeset
  1175
    REGISTER int indx;
3df87ac8838c added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents: 2511
diff changeset
  1176
    int nIndex;
3df87ac8838c added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents: 2511
diff changeset
  1177
    REGISTER OBJ slf;
3df87ac8838c added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents: 2511
diff changeset
  1178
    REGISTER OBJ cls;
3df87ac8838c added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents: 2511
diff changeset
  1179
3df87ac8838c added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents: 2511
diff changeset
  1180
    if (__isSmallInteger(index)) {
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1181
        slf = self;
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1182
        if (__isNonNilObject(slf)) {
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1183
            unsigned char *pFirst;
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1184
            int nIndex;
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1185
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1186
            cls = __qClass(slf);
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1187
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1188
            pFirst = __ByteArrayInstPtr(slf)->ba_element;
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1189
            pFirst += __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars));
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1190
            nIndex = __byteArraySize(slf);
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1191
            indx = __intVal(index) - 1;
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1192
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1193
            switch ((INT)(__ClassInstPtr(cls)->c_flags) & __MASKSMALLINT(ARRAYMASK)) {
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1194
                case __MASKSMALLINT(DOUBLEARRAY):
3921
8e07cb118aa3 added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents: 3841
diff changeset
  1195
#ifdef __NEED_DOUBLE_ALIGN
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1196
                    if ((INT)pFirst & (__DOUBLE_ALIGN-1)) {
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1197
                        int delta = __DOUBLE_ALIGN - ((INT)pFirst & (__DOUBLE_ALIGN-1));
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1198
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1199
                        pFirst += delta;
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1200
                        nIndex -= delta;
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1201
                    }
3921
8e07cb118aa3 added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents: 3841
diff changeset
  1202
#endif
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1203
                    /* fall into */
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1204
                case __MASKSMALLINT(BYTEARRAY):
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1205
                case __MASKSMALLINT(WORDARRAY):
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1206
                case __MASKSMALLINT(LONGARRAY):
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1207
                case __MASKSMALLINT(SWORDARRAY):
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1208
                case __MASKSMALLINT(SLONGARRAY):
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1209
                case __MASKSMALLINT(FLOATARRAY):
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1210
                    if ((unsigned)indx < (unsigned)nIndex) {
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1211
                        RETURN ( __MKSMALLINT( pFirst[indx]) );
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1212
                    }
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1213
                    break;
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1214
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1215
                case __MASKSMALLINT(LONGLONGARRAY):
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1216
                case __MASKSMALLINT(SLONGLONGARRAY):
3921
8e07cb118aa3 added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents: 3841
diff changeset
  1217
#ifdef __NEED_LONGLONG_ALIGN
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1218
                    if ((INT)pFirst & (__LONGLONG_ALIGN-1)) {
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1219
                        int delta = __LONGLONG_ALIGN - ((INT)pFirst & (__LONGLONG_ALIGN-1));
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1220
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1221
                        pFirst += delta;
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1222
                        nIndex -= delta;
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1223
                    }
3921
8e07cb118aa3 added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents: 3841
diff changeset
  1224
#endif
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1225
                    if ((unsigned)indx < (unsigned)nIndex) {
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1226
                        RETURN ( __MKSMALLINT( pFirst[indx]) );
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1227
                    }
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1228
                    break;
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1229
            }
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1230
        }
2574
3df87ac8838c added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents: 2511
diff changeset
  1231
    }
3df87ac8838c added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents: 2511
diff changeset
  1232
%}.
3df87ac8838c added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents: 2511
diff changeset
  1233
    "/ index not integer or index out of range
3df87ac8838c added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents: 2511
diff changeset
  1234
    "/ or non-byte indexable receiver
3df87ac8838c added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents: 2511
diff changeset
  1235
3df87ac8838c added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents: 2511
diff changeset
  1236
    ^ self primitiveFailed
3df87ac8838c added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents: 2511
diff changeset
  1237
3df87ac8838c added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents: 2511
diff changeset
  1238
    "
3df87ac8838c added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents: 2511
diff changeset
  1239
     Point new byteAt:1
3df87ac8838c added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents: 2511
diff changeset
  1240
     (ByteArray with:1 with:2) byteAt:2
3df87ac8838c added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents: 2511
diff changeset
  1241
     (WordArray with:1) byteAt:1       
3df87ac8838c added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents: 2511
diff changeset
  1242
     (FloatArray with:1.0) byteAt:2 
3df87ac8838c added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents: 2511
diff changeset
  1243
     'hello' byteAt:1               
3df87ac8838c added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents: 2511
diff changeset
  1244
    "
3df87ac8838c added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents: 2511
diff changeset
  1245
!
3df87ac8838c added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents: 2511
diff changeset
  1246
3df87ac8838c added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents: 2511
diff changeset
  1247
byteAt:index put:byteValue
3df87ac8838c added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents: 2511
diff changeset
  1248
    "set the byte at index. 
3df87ac8838c added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents: 2511
diff changeset
  1249
     This is only allowed for non-pointer indexed objects
3df87ac8838c added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents: 2511
diff changeset
  1250
     (i.e. byteArrays, wordArrays, floatArrays etc.).
3df87ac8838c added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents: 2511
diff changeset
  1251
     The receivers indexed instvars are treated as an uninterpreted
3df87ac8838c added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents: 2511
diff changeset
  1252
     collection of bytes.
3df87ac8838c added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents: 2511
diff changeset
  1253
     Only useful with binary storage."
3df87ac8838c added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents: 2511
diff changeset
  1254
3df87ac8838c added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents: 2511
diff changeset
  1255
%{  /* NOCONTEXT */
3df87ac8838c added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents: 2511
diff changeset
  1256
3df87ac8838c added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents: 2511
diff changeset
  1257
    REGISTER int indx;
3df87ac8838c added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents: 2511
diff changeset
  1258
    int val, nIndex;
3df87ac8838c added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents: 2511
diff changeset
  1259
    REGISTER OBJ slf;
3df87ac8838c added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents: 2511
diff changeset
  1260
    REGISTER OBJ cls;
3df87ac8838c added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents: 2511
diff changeset
  1261
3df87ac8838c added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents: 2511
diff changeset
  1262
    if (__bothSmallInteger(index, byteValue)) {
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1263
        val = __intVal(byteValue);
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1264
        if ((unsigned)(val) <= 0xFF /* i.e. (val >= 0) && (val <= 255) */) {
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1265
            slf = self;
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1266
            if (__isNonNilObject(slf)) {
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1267
                cls = __qClass(slf);
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1268
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1269
                indx = __intVal(index) - 1;
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1270
                switch ((INT)(__ClassInstPtr(cls)->c_flags) & __MASKSMALLINT(ARRAYMASK)) {
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1271
                    case __MASKSMALLINT(BYTEARRAY):
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1272
                    case __MASKSMALLINT(WORDARRAY):
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1273
                    case __MASKSMALLINT(LONGARRAY):
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1274
                    case __MASKSMALLINT(SWORDARRAY):
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1275
                    case __MASKSMALLINT(SLONGARRAY):
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1276
                    case __MASKSMALLINT(LONGLONGARRAY):
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1277
                    case __MASKSMALLINT(SLONGLONGARRAY):
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1278
                    case __MASKSMALLINT(FLOATARRAY):
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1279
                    case __MASKSMALLINT(DOUBLEARRAY):
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1280
                        indx += __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars));
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1281
                        nIndex = __byteArraySize(slf);
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1282
                        if ((unsigned)indx < (unsigned)nIndex) {
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1283
                            __ByteArrayInstPtr(slf)->ba_element[indx] = val;
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1284
                            RETURN ( byteValue );
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1285
                        }
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1286
                        break;
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1287
                }
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1288
            }
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1289
        }
2574
3df87ac8838c added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents: 2511
diff changeset
  1290
    }
3df87ac8838c added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents: 2511
diff changeset
  1291
%}.
3df87ac8838c added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents: 2511
diff changeset
  1292
    "/ index not integer or index out of range
3df87ac8838c added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents: 2511
diff changeset
  1293
    "/ or non-byte indexable receiver
3df87ac8838c added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents: 2511
diff changeset
  1294
3df87ac8838c added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents: 2511
diff changeset
  1295
    ^ self primitiveFailed
3df87ac8838c added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents: 2511
diff changeset
  1296
3df87ac8838c added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents: 2511
diff changeset
  1297
    "
3df87ac8838c added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents: 2511
diff changeset
  1298
     (ByteArray with:1 with:2) byteAt:2 put:3; yourself
3df87ac8838c added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents: 2511
diff changeset
  1299
     'hello' copy byteAt:1 put:105; yourself              
3df87ac8838c added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents: 2511
diff changeset
  1300
    "
3df87ac8838c added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents: 2511
diff changeset
  1301
!
3df87ac8838c added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents: 2511
diff changeset
  1302
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1303
instVarAt:index
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1304
    "return a non-indexed instance variable;
13
62303f84ff5f *** empty log message ***
claus
parents: 10
diff changeset
  1305
     peeking into an object this way is not very object oriented 
62303f84ff5f *** empty log message ***
claus
parents: 10
diff changeset
  1306
     - use with care (needed for copy, inspector etc.)"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1307
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1308
%{  /* NOCONTEXT */
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1309
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1310
    OBJ myClass;
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1311
    int idx, ninstvars;
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1312
253
30daee717a53 *** empty log message ***
claus
parents: 228
diff changeset
  1313
    if (__isSmallInteger(index)) {
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1314
        myClass = __Class(self);
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1315
        idx = __intVal(index) - 1;
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1316
        /*
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1317
         * do not allow returning of non-object fields.
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1318
         * if subclass did not make privisions for that,
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1319
         * we wont do so here ...
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1320
         */
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1321
        if (((INT)(__ClassInstPtr(myClass)->c_flags) & __MASKSMALLINT(NONOBJECT_INSTS))) {
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1322
            if (idx == 0) {
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1323
                RETURN ( nil )
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1324
            }
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1325
        }
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1326
        ninstvars = __intVal(__ClassInstPtr(myClass)->c_ninstvars);
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1327
        if ((idx >= 0) && (idx < ninstvars)) {
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1328
            RETURN ( __InstPtr(self)->i_instvars[idx] );
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1329
        }
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1330
    }
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1331
%}
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1332
.
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1333
    index isInteger ifFalse:[
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1334
        ^ self indexNotInteger
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1335
    ].
159
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1336
    ^ self subscriptBoundsError:index
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1337
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1338
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1339
instVarAt:index put:value
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1340
    "change a non-indexed instance variable;
13
62303f84ff5f *** empty log message ***
claus
parents: 10
diff changeset
  1341
     peeking into an object this way is not very object oriented 
62303f84ff5f *** empty log message ***
claus
parents: 10
diff changeset
  1342
     - use with care (needed for copy, inspector etc.)"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1343
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1344
%{  /* NOCONTEXT */
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1345
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1346
    OBJ myClass;
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1347
    int idx, ninstvars;
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1348
253
30daee717a53 *** empty log message ***
claus
parents: 228
diff changeset
  1349
    if (__isSmallInteger(index)) {
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1350
        myClass = __Class(self);
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1351
        idx = __intVal(index) - 1;
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1352
        ninstvars = __intVal(__ClassInstPtr(myClass)->c_ninstvars);
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1353
        /*
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1354
         * do not allow setting of non-object fields.
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1355
         * if subclass did not make privisions for that,
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1356
         * we wont do so here ...
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1357
         */
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1358
        if (((INT)(__ClassInstPtr(myClass)->c_flags) & __MASKSMALLINT(NONOBJECT_INSTS))) {
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1359
            if (idx == 0) {
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1360
                RETURN ( nil )
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1361
            }
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1362
        }
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1363
        if ((idx >= 0) && (idx < ninstvars)) {
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1364
            __InstPtr(self)->i_instvars[idx] = value;
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1365
            __STORE(self, value);
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1366
            RETURN ( value );
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1367
        }
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1368
    }
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1369
%}
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1370
.
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1371
    index isInteger ifFalse:[
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1372
        ^ self indexNotInteger
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1373
    ].
159
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1374
    ^ self subscriptBoundsError:index
359
claus
parents: 357
diff changeset
  1375
!
claus
parents: 357
diff changeset
  1376
claus
parents: 357
diff changeset
  1377
instVarNamed:name 
claus
parents: 357
diff changeset
  1378
    "return a non-indexed instance variables value by name;
claus
parents: 357
diff changeset
  1379
     peeking into an object this way is not very object oriented 
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  1380
     - use with care if at all (provided for inspectors and memory usage monitor).
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  1381
     Notice, this access is very slow (because the classes instVar-description has to be
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  1382
     parsed ad runtime)"
359
claus
parents: 357
diff changeset
  1383
claus
parents: 357
diff changeset
  1384
    ^ self instVarAt:(self class instVarOffsetOf:name)
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  1385
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  1386
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  1387
    "
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  1388
     |p|
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  1389
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  1390
     p := Point x:10 y:20.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  1391
     p instVarNamed:'x'  
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  1392
    "
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  1393
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  1394
    "Modified: 19.4.1996 / 11:12:39 / cg"
359
claus
parents: 357
diff changeset
  1395
!
claus
parents: 357
diff changeset
  1396
1528
af168e6dadc9 added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 1515
diff changeset
  1397
instVarNamed:name ifAbsent:exceptionBlock
af168e6dadc9 added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 1515
diff changeset
  1398
    "return a non-indexed instance variables value by name,
af168e6dadc9 added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 1515
diff changeset
  1399
     or the value of exceptionBlock, if there is no such instance variable.
af168e6dadc9 added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 1515
diff changeset
  1400
     peeking into an object this way is not very object oriented 
af168e6dadc9 added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 1515
diff changeset
  1401
     - use with care if at all (provided for inspectors and memory usage monitor).
af168e6dadc9 added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 1515
diff changeset
  1402
     Notice, this access is very slow (because the classes instVar-description has to be
af168e6dadc9 added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 1515
diff changeset
  1403
     parsed ad runtime)"
af168e6dadc9 added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 1515
diff changeset
  1404
af168e6dadc9 added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 1515
diff changeset
  1405
    |idx|
af168e6dadc9 added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 1515
diff changeset
  1406
af168e6dadc9 added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 1515
diff changeset
  1407
    idx := self class instVarOffsetOf:name.
af168e6dadc9 added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 1515
diff changeset
  1408
    idx isNil ifTrue:[^ exceptionBlock value].
af168e6dadc9 added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 1515
diff changeset
  1409
    ^ self instVarAt:idx
af168e6dadc9 added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 1515
diff changeset
  1410
af168e6dadc9 added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 1515
diff changeset
  1411
af168e6dadc9 added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 1515
diff changeset
  1412
    "
af168e6dadc9 added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 1515
diff changeset
  1413
     |p|
af168e6dadc9 added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 1515
diff changeset
  1414
af168e6dadc9 added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 1515
diff changeset
  1415
     p := Point x:10 y:20.
af168e6dadc9 added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 1515
diff changeset
  1416
     p instVarNamed:'x'  
af168e6dadc9 added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 1515
diff changeset
  1417
    "
af168e6dadc9 added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 1515
diff changeset
  1418
af168e6dadc9 added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 1515
diff changeset
  1419
    "Created: 6.7.1996 / 23:02:49 / cg"
af168e6dadc9 added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 1515
diff changeset
  1420
    "Modified: 6.7.1996 / 23:03:41 / cg"
af168e6dadc9 added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 1515
diff changeset
  1421
!
af168e6dadc9 added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 1515
diff changeset
  1422
359
claus
parents: 357
diff changeset
  1423
instVarNamed:name put:value
claus
parents: 357
diff changeset
  1424
    "set a non-indexed instance variable by name;
claus
parents: 357
diff changeset
  1425
     peeking into an object this way is not very object oriented 
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  1426
     - if at all, use with care (provided for protocol completeness).
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  1427
     Notice, this access is very slow (because the classes instVar-description has to be
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  1428
     parsed ad runtime)"
359
claus
parents: 357
diff changeset
  1429
claus
parents: 357
diff changeset
  1430
    ^ self instVarAt:(self class instVarOffsetOf:name) put:value
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  1431
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  1432
    "
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  1433
     |p|
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  1434
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  1435
     p := Point x:10 y:20.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  1436
     p instVarNamed:'x' put:30.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  1437
     p  
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  1438
    "
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  1439
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  1440
    "Modified: 19.4.1996 / 11:12:49 / cg"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1441
! !
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1442
3268
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1443
!Object methodsFor:'attributes access'!
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1444
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1445
objectAttributeAt:key 
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1446
    "return the attribute for a given key or nil if not found"
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1447
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1448
    | attrs |
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1449
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1450
    attrs := self objectAttributes.
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1451
    (attrs notNil and:[attrs size > 0]) ifTrue:[
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1452
        ^ attrs at:key ifAbsent:[]
3268
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1453
    ].
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1454
    ^ nil
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1455
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1456
    "Created: / 22.1.1998 / 21:29:17 / av"
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1457
    "Modified: / 3.2.1998 / 18:55:55 / cg"
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1458
!
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1459
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1460
objectAttributeAt:key put:anObject
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1461
    "store the attribute anObject referenced by key into the receiver"
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1462
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1463
    |wasBlocked|
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1464
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1465
    "/ must do this save from interrupts, since the attributes collection
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1466
    "/ is possibly accessed from multiple threads ...
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1467
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1468
    wasBlocked := OperatingSystem blockInterrupts.
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1469
    [
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1470
        | attrs |
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1471
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1472
        attrs := self objectAttributes.
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1473
        (attrs isNil or:[attrs size == 0]) ifTrue:[
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1474
            attrs := WeakIdentityDictionary new.
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1475
            attrs at:key put:anObject.
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1476
            self objectAttributes:attrs.
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1477
        ] ifFalse:[ 
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1478
            attrs at:key put:anObject.
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1479
        ].
3268
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1480
    ] valueNowOrOnUnwindDo:[
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1481
        wasBlocked ifFalse:[
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1482
            OperatingSystem unblockInterrupts
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1483
        ]
3268
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1484
    ]
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1485
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1486
    "Attaching additional attributes (slots) to an arbitrary object:
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1487
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1488
     |p|
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1489
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1490
     p := Point new.
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1491
     p objectAttributeAt:#color put:#green.
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1492
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1493
     p objectAttributeAt:#color
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1494
    "
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1495
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1496
    "Created: / 22.1.1998 / 21:29:25 / av"
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1497
    "Modified: / 3.2.1998 / 18:57:58 / cg"
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1498
!
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1499
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1500
objectAttributes
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1501
    "return a Collection of attributes - nil if there is none.
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1502
     The default implementation here uses a global WeakDictionary to store
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1503
     attributes
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1504
     This may be too slow for high frequency slot access,
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1505
     therefore, some classes may redefine this for better performance.
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1506
     Notice the mentioning of a WeakDictionary - read the classes documentation."
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1507
5270
01a597622eaf fixed #removeAttribute
Claus Gittinger <cg@exept.de>
parents: 5252
diff changeset
  1508
    ^ ObjectAttributes at:self ifAbsent:[nil]
3268
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1509
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1510
    "Created: / 22.1.1998 / 21:29:30 / av"
5270
01a597622eaf fixed #removeAttribute
Claus Gittinger <cg@exept.de>
parents: 5252
diff changeset
  1511
    "Modified: / 18.2.2000 / 11:34:16 / cg"
3268
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1512
!
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1513
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1514
objectAttributes:aCollection
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1515
    "set the collection of attributes.
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1516
     The default implementation here uses a global Dictionary to store
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1517
     attributes which may be too slow for high frequency change&update.
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1518
     Therefore, some classes may redefine this for better performance."
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1519
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1520
    "/ must do this save from interrupts, since the attributes collection
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1521
    "/ is possibly accessed from multiple threads.
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1522
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1523
    (OperatingSystem blockInterrupts) ifTrue:[
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1524
        "/ the common case - already blocked
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1525
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1526
        (aCollection isNil or:[aCollection isEmpty]) ifTrue:[
5424
3ffaef20cfd0 removeKey:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 5421
diff changeset
  1527
            ObjectAttributes removeKey:self ifAbsent:nil
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1528
        ] ifFalse:[
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1529
            ObjectAttributes at:self put:aCollection
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1530
        ].
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1531
        ^ self
3268
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1532
    ].
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1533
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1534
    [
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1535
        (aCollection isNil or:[aCollection isEmpty]) ifTrue:[
5424
3ffaef20cfd0 removeKey:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 5421
diff changeset
  1536
            ObjectAttributes removeKey:self ifAbsent:nil
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1537
        ] ifFalse:[
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1538
            ObjectAttributes at:self put:aCollection
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1539
        ].
3268
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1540
    ] valueNowOrOnUnwindDo:[
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1541
        OperatingSystem unblockInterrupts
3268
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1542
    ]
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1543
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1544
    "Created: / 22.1.1998 / 21:29:35 / av"
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1545
    "Modified: / 3.2.1998 / 18:58:10 / cg"
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1546
!
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1547
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1548
removeObjectAttribute:anObject
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1549
    "make the argument, anObject be no attribute of the receiver"
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1550
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1551
    |wasBlocked|
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1552
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1553
    "/ must do this save from interrupts, since the attributes collection
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1554
    "/ is possibly accessed from multiple threads.
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1555
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1556
    wasBlocked := OperatingSystem blockInterrupts.
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1557
    [
5270
01a597622eaf fixed #removeAttribute
Claus Gittinger <cg@exept.de>
parents: 5252
diff changeset
  1558
        |attrs n a|
01a597622eaf fixed #removeAttribute
Claus Gittinger <cg@exept.de>
parents: 5252
diff changeset
  1559
01a597622eaf fixed #removeAttribute
Claus Gittinger <cg@exept.de>
parents: 5252
diff changeset
  1560
        attrs := self objectAttributes.
01a597622eaf fixed #removeAttribute
Claus Gittinger <cg@exept.de>
parents: 5252
diff changeset
  1561
        attrs size == 0 ifTrue:[
01a597622eaf fixed #removeAttribute
Claus Gittinger <cg@exept.de>
parents: 5252
diff changeset
  1562
            self objectAttributes:nil
01a597622eaf fixed #removeAttribute
Claus Gittinger <cg@exept.de>
parents: 5252
diff changeset
  1563
        ] ifFalse:[
5424
3ffaef20cfd0 removeKey:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 5421
diff changeset
  1564
            attrs removeKey:anObject ifAbsent:nil.
5270
01a597622eaf fixed #removeAttribute
Claus Gittinger <cg@exept.de>
parents: 5252
diff changeset
  1565
            attrs size == 0 ifTrue:[
01a597622eaf fixed #removeAttribute
Claus Gittinger <cg@exept.de>
parents: 5252
diff changeset
  1566
                self objectAttributes:nil
01a597622eaf fixed #removeAttribute
Claus Gittinger <cg@exept.de>
parents: 5252
diff changeset
  1567
            ]
01a597622eaf fixed #removeAttribute
Claus Gittinger <cg@exept.de>
parents: 5252
diff changeset
  1568
        ]
3268
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1569
    ] valueNowOrOnUnwindDo:[
5270
01a597622eaf fixed #removeAttribute
Claus Gittinger <cg@exept.de>
parents: 5252
diff changeset
  1570
        wasBlocked ifFalse:[
01a597622eaf fixed #removeAttribute
Claus Gittinger <cg@exept.de>
parents: 5252
diff changeset
  1571
            OperatingSystem unblockInterrupts
01a597622eaf fixed #removeAttribute
Claus Gittinger <cg@exept.de>
parents: 5252
diff changeset
  1572
        ]
3268
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1573
    ]
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1574
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1575
    "Created: / 22.1.1998 / 21:29:39 / av"
5270
01a597622eaf fixed #removeAttribute
Claus Gittinger <cg@exept.de>
parents: 5252
diff changeset
  1576
    "Modified: / 18.2.2000 / 11:32:19 / cg"
3268
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1577
! !
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1578
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1579
!Object methodsFor:'binary storage'!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1580
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1581
hasSpecialBinaryRepresentation
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1582
    "return true, if the receiver has a special binary representation;
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1583
     default here is false, but can be redefined in class which provide
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1584
     their own storeBinary/readBinary methods.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1585
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1586
     Normal user classes should not use this, it is meant as a hook for
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1587
     special classes such as True, False, UndefinedObject or SmallInteger.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1588
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1589
     If your instances should be stored in a special way, see
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1590
     #representBinaryOn: and #readBinaryContentsFromdata:manager:."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1591
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1592
    ^ false
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1593
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1594
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1595
readBinaryContentsFrom:stream manager:manager
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1596
    "reconstruct the receivers instance variables by reading a binary
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1597
     binary representation from stream. 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1598
     This is a general implementation, walking over instances 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1599
     and loading each recursively using manager.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1600
     Redefined by some classes to read a more compact representations
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1601
     (see String, SmallInteger etc).
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1602
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1603
     Notice, that the object is already recreated as an empty corps
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1604
     with instance variables all nil and bit-instances (bytes, words etc.) 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1605
     already read and restored.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1606
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1607
     Also notice: this method is not called for if a private representation
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1608
     has been stored (see representBinaryOn:). 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1609
     In that case, #readBinaryContentsFromData:manager: is called, which
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1610
     has to be reimplemented in the objects class."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1611
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1612
    |size "{ Class: SmallInteger }"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1613
     instvarArray|
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1614
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1615
    stream next == 1 ifTrue:[
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1616
        "/
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1617
        "/ special representation ...
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1618
        "/
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1619
        instvarArray := Array new:(size := stream nextNumber:3).
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1620
        1 to:size do:[:i |
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1621
            instvarArray basicAt:i put:(manager nextObject)
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1622
        ].
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1623
        self readBinaryContentsFromData:instvarArray manager:manager.
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1624
        ^ self
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1625
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1626
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1627
    "/
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1628
    "/ standard representation
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1629
    "/
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1630
    size := self basicSize.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1631
    size ~~ 0 ifTrue:[
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1632
        self class isPointers ifTrue:[
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1633
            1 to:size do:[:i |
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1634
                self basicAt:i put:(manager nextObject)
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1635
            ]
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1636
        ]
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1637
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1638
    size := self class instSize.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1639
    1 to:size do:[:i |
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1640
        self instVarAt:i put:(manager nextObject)
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1641
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1642
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1643
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1644
readBinaryContentsFromData:instvarArray manager:manager
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1645
    "reconstruct the receivers instance variables by filling instance
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1646
     variables with values from instvarArray. This array contains the instvars
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1647
     as specified in #representBinaryOn: when the object was stored.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1648
     It is the receivers responsibility to set its instance variables in the
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1649
     same order from that array."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1650
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1651
    ^ self subclassResponsibility
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1652
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1653
    "typical implementation (see also comment in #representBinaryOn:)
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1654
     (for an object with foo, bar and baz as instance variables,
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1655
      which did not store baz and wants baz to be reinitialized to
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1656
      some constant string)
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1657
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1658
        foo := instvarArray at:1.
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1659
        bar := instvarArray at:2.
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1660
        baz := 'aConstant'.
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1661
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1662
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1663
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1664
representBinaryOn:manager
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1665
    "this method is called by the storage manager to ask objects
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1666
     if they wish to provide their own binary representation.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1667
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1668
     If they want to do so, they should return an array containing all
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1669
     instance variables (named & indexed pointer) to be stored. 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1670
     If not redefined, this method returns nil which means that all 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1671
     instance variables are to be stored.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1672
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1673
     It should be redefined in objects which do not want all instance variables
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1674
     to be stored (for example: objects which keep references to a view etc.).
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1675
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1676
     If this is redefined returning non-nil, the corresponding class needs
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1677
     a redefined instance method named #readBinaryContentsFromData:manager:
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1678
     which has to fill the receivers named (and optionally indexed pointer)
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1679
     instance variables with corresponding values from a data array."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1680
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1681
    ^ nil
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1682
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1683
    "typical implementation:  
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1684
     (see also comment in #readBinaryContentsFromData:manager:)
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1685
     for an object with foo, bar and baz as instance variables,
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1686
     which does not want to store baz:
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1687
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1688
     representBinaryOn:manager
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1689
        |data|
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1690
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1691
        data := Array new:2.
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1692
        data at:1 put:foo.
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1693
        data at:2 put:bar.
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1694
        ^ data
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1695
    "
159
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1696
!
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1697
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1698
storeBinaryDefinitionBodyOn:stream manager:manager
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1699
    "append a binary representation of the receivers body onto stream.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1700
     This is a general implementation walking over instances storing
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1701
     each recursively as an ID using manager.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1702
     Can be redefined in subclasses."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1703
3078
e48f06979043 binary storage tuning
Claus Gittinger <cg@exept.de>
parents: 3066
diff changeset
  1704
    |basicSize    "{ Class: SmallInteger }"
e48f06979043 binary storage tuning
Claus Gittinger <cg@exept.de>
parents: 3066
diff changeset
  1705
     instSize     "{ Class: SmallInteger }"
e48f06979043 binary storage tuning
Claus Gittinger <cg@exept.de>
parents: 3066
diff changeset
  1706
     specialSize  "{ Class: SmallInteger }"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1707
     myClass specialRep pointers|
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1708
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1709
    myClass := self class.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1710
    instSize := myClass instSize.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1711
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1712
    (pointers := myClass isPointers) ifTrue:[
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1713
        "/
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1714
        "/ inst size not needed - if you uncomment the line below,
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1715
        "/ also uncomment the corresponding line in
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1716
        "/ Object>>binaryDefinitionFrom:manager:
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1717
        "/
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1718
        "/ stream nextPut:instSize. "mhmh this limits us to 255 named instvars"
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1719
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1720
        myClass isVariable ifTrue:[
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1721
            stream nextNumber:3 put:(basicSize := self basicSize)
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1722
        ] ifFalse:[
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1723
            basicSize := 0
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1724
        ].
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1725
    ] ifFalse: [
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1726
        stream nextNumber:4 put:(basicSize := self basicSize).
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1727
        myClass isBytes ifTrue:[
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1728
            1 to:basicSize do:[:i |
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1729
                stream nextPut:(self basicAt:i)
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1730
            ]
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1731
        ] ifFalse:[
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1732
            myClass isWords ifTrue:[
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1733
                1 to:basicSize do:[:i |
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1734
                    stream nextNumber:2 put:(self basicAt: i)
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1735
                ]
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1736
            ] ifFalse:[
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1737
                myClass isLongs ifTrue:[
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1738
                    1 to:basicSize do:[:i |
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1739
                        stream nextNumber:4 put:(self basicAt: i)
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1740
                    ]
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1741
                ] ifFalse:[
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1742
                    myClass isFloats ifTrue:[
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1743
                        "could do it in one big write on machines which use IEEE floats ..."
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1744
                        1 to:basicSize do:[:i |
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1745
                            Float storeBinaryIEEESingle:(self basicAt:i) on:stream
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1746
                        ]
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1747
                    ] ifFalse:[
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1748
                        myClass isDoubles ifTrue:[
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1749
                            "could do it in one big write on machines which use IEEE doubles ..."
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1750
                            1 to:basicSize do:[:i |
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1751
                                Float storeBinaryIEEEDouble:(self basicAt:i) on:stream
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1752
                            ]
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1753
                        ] ifFalse:[
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1754
                            "/ should never be reached ...
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1755
                            1 to:basicSize do:[:i |
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1756
                                manager putIdOf:(self basicAt:i) on:stream
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1757
                            ]
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1758
                        ]
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1759
                    ]
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1760
                ]
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1761
            ]
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1762
        ].
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1763
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1764
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1765
    (pointers or:[instSize ~~ 0]) ifTrue:[
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1766
        specialRep := self representBinaryOn:manager.
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1767
        specialRep notNil ifTrue:[
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1768
            specialSize := specialRep basicSize.
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1769
            stream nextPut:1.     "/ means: private representation follows
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1770
            stream nextNumber:3 put:specialSize.
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1771
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1772
            1 to:specialSize do:[:i |
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1773
                manager putIdOf:(specialRep at:i) on:stream
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1774
            ].
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1775
        ] ifFalse:[
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1776
            stream nextPut:0.     "/ means: normal representation follows
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1777
                                  "/ index pointers followed by named instanceVars
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1778
            pointers ifTrue:[
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1779
                basicSize ~~ 0 ifTrue:[
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1780
                    1 to:basicSize do:[:i |
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1781
                        manager putIdOf:(self basicAt:i) on:stream
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1782
                    ].
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1783
                ].
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1784
            ].
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1785
            instSize ~~ 0 ifTrue:[
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1786
                1 to:instSize do:[:i |
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1787
                    manager putIdOf:(self instVarAt:i) on:stream
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1788
                ]
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1789
            ].
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1790
        ]
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1791
    ]
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1792
3078
e48f06979043 binary storage tuning
Claus Gittinger <cg@exept.de>
parents: 3066
diff changeset
  1793
    "Modified: / 2.11.1997 / 14:43:29 / cg"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1794
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1795
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1796
storeBinaryDefinitionOn:stream manager:manager
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1797
    "append a binary representation of the receiver onto stream.
1260
2a8ba44e8957 commentary
Claus Gittinger <cg@exept.de>
parents: 1231
diff changeset
  1798
     This is an internal interface for binary storage mechanism.
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1799
     This method first stores the class, then the body, which is done
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1800
     in a separate method to allow redefinition of the bodies format.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1801
     Can be redefined in subclasses to write more compact representations
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1802
     (see String, SmallInteger etc)."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1803
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1804
    manager putIdOfClass:(self class) on:stream.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1805
    self storeBinaryDefinitionBodyOn:stream manager:manager
1260
2a8ba44e8957 commentary
Claus Gittinger <cg@exept.de>
parents: 1231
diff changeset
  1806
2a8ba44e8957 commentary
Claus Gittinger <cg@exept.de>
parents: 1231
diff changeset
  1807
    "Modified: 23.4.1996 / 09:31:12 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1808
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1809
3078
e48f06979043 binary storage tuning
Claus Gittinger <cg@exept.de>
parents: 3066
diff changeset
  1810
storeBinaryOn:aStreamOrFilename
e48f06979043 binary storage tuning
Claus Gittinger <cg@exept.de>
parents: 3066
diff changeset
  1811
    "Writes a description of the receiver onto aStreamOrFilename, in a way that allows
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1812
     the object's structure to be reconstructed from the stream's contents"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1813
3078
e48f06979043 binary storage tuning
Claus Gittinger <cg@exept.de>
parents: 3066
diff changeset
  1814
    BinaryOutputManager store:self on:aStreamOrFilename
899
ddcdb74e52de commentary
Claus Gittinger <cg@exept.de>
parents: 891
diff changeset
  1815
ddcdb74e52de commentary
Claus Gittinger <cg@exept.de>
parents: 891
diff changeset
  1816
    "
ddcdb74e52de commentary
Claus Gittinger <cg@exept.de>
parents: 891
diff changeset
  1817
     |a s1 s2|
ddcdb74e52de commentary
Claus Gittinger <cg@exept.de>
parents: 891
diff changeset
  1818
ddcdb74e52de commentary
Claus Gittinger <cg@exept.de>
parents: 891
diff changeset
  1819
     s1 := 'hello'.
ddcdb74e52de commentary
Claus Gittinger <cg@exept.de>
parents: 891
diff changeset
  1820
     s2 := 'world'.
ddcdb74e52de commentary
Claus Gittinger <cg@exept.de>
parents: 891
diff changeset
  1821
     a := Array new:5.
ddcdb74e52de commentary
Claus Gittinger <cg@exept.de>
parents: 891
diff changeset
  1822
     a at:1 put:s1.
ddcdb74e52de commentary
Claus Gittinger <cg@exept.de>
parents: 891
diff changeset
  1823
     a at:2 put:s2.
ddcdb74e52de commentary
Claus Gittinger <cg@exept.de>
parents: 891
diff changeset
  1824
     a at:3 put:s1.
ddcdb74e52de commentary
Claus Gittinger <cg@exept.de>
parents: 891
diff changeset
  1825
     a at:4 put:s2.
ddcdb74e52de commentary
Claus Gittinger <cg@exept.de>
parents: 891
diff changeset
  1826
     a storeBinaryOn:'test.boss'
ddcdb74e52de commentary
Claus Gittinger <cg@exept.de>
parents: 891
diff changeset
  1827
    "
ddcdb74e52de commentary
Claus Gittinger <cg@exept.de>
parents: 891
diff changeset
  1828
ddcdb74e52de commentary
Claus Gittinger <cg@exept.de>
parents: 891
diff changeset
  1829
    "
ddcdb74e52de commentary
Claus Gittinger <cg@exept.de>
parents: 891
diff changeset
  1830
     (BinaryObjectStorage onOld:'test.boss' asFilename readStream)
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1831
        next
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1832
            inspect
899
ddcdb74e52de commentary
Claus Gittinger <cg@exept.de>
parents: 891
diff changeset
  1833
    "
3078
e48f06979043 binary storage tuning
Claus Gittinger <cg@exept.de>
parents: 3066
diff changeset
  1834
e48f06979043 binary storage tuning
Claus Gittinger <cg@exept.de>
parents: 3066
diff changeset
  1835
    "Modified: / 1.11.1997 / 21:16:24 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1836
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1837
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1838
storeBinaryOn:stream manager:manager
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1839
    "append a binary representation of the receiver onto stream."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1840
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1841
    manager putIdOf:self on:stream
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1842
! !
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1843
1826
aa574220fff4 category rename
Claus Gittinger <cg@exept.de>
parents: 1820
diff changeset
  1844
!Object methodsFor:'change & update'!
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1845
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1846
broadcast:aSelectorSymbol
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1847
    "send a message with selector aSelectorSymbol to all my dependents"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1848
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1849
    self dependentsDo:[:dependent | 
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1850
        dependent perform:aSelectorSymbol
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1851
    ]
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1852
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1853
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1854
broadcast:aSelectorSymbol with:anArgument
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1855
    "send a message with selector aSelectorSymbol with an additional
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1856
     argument anArgument to all my dependents."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1857
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1858
    self dependentsDo:[:dependent | 
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1859
        dependent perform:aSelectorSymbol with:anArgument
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1860
    ]
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1861
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1862
159
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1863
changeRequest
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1864
    "the receiver wants to change - check if all dependents
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1865
     grant the request, and return true if so"
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1866
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1867
    self dependentsDo:[:dependent | 
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1868
        dependent updateRequest ifFalse:[^ false].
159
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1869
    ].
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1870
    ^ true
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1871
!
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1872
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1873
changeRequest:aParameter
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1874
    "the receiver wants to change - check if all dependents
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1875
     grant the request, and return true if so"
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1876
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1877
    self dependentsDo:[:dependent | 
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1878
        (dependent updateRequest:aParameter) ifFalse:[^ false].
159
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1879
    ].
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1880
    ^ true
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1881
!
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1882
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1883
changeRequest:aParameter from:anObject
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1884
    "the receiver wants to change - check if all dependents
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1885
     except anObject grant the request, and return true if so.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1886
     The argument anObject is typically going to be the one who is
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1887
     about to send the change request."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1888
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1889
    self dependentsDo:[:dependent | 
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1890
        dependent == anObject ifFalse:[
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1891
            (dependent updateRequest:aParameter) ifFalse:[^ false].
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1892
        ]
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1893
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1894
    ^ true
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1895
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1896
159
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1897
changeRequestFrom:anObject
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1898
    "the receiver wants to change - check if all dependents
202
40ca7cc6fb9c *** empty log message ***
claus
parents: 179
diff changeset
  1899
     except anObject grant the request, and return true if so.
40ca7cc6fb9c *** empty log message ***
claus
parents: 179
diff changeset
  1900
     The argument anObject is typically going to be the one who is
40ca7cc6fb9c *** empty log message ***
claus
parents: 179
diff changeset
  1901
     about to send the change request."
159
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1902
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1903
    self dependentsDo:[:dependent | 
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1904
        dependent == anObject ifFalse:[
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1905
            (dependent updateRequest) ifFalse:[^ false].
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1906
        ]
159
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1907
    ].
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1908
    ^ true
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1909
!
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1910
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1911
changed
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1912
    "notify all dependents that the receiver has changed.
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  1913
     Each dependent gets a '#update:'-message with the original
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  1914
     receiver as argument."
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1915
159
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1916
    self changed:nil
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1917
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1918
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1919
changed:aParameter
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1920
    "notify all dependents that the receiver has changed somehow.
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  1921
     Each dependent gets a '#update:'-message with aParameter
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  1922
     as argument."
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1923
159
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1924
    self changed:aParameter with:nil
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1925
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1926
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  1927
changed:aParameter with:anArgument
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1928
    "notify all dependents that the receiver has changed somehow.
159
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1929
     Each dependent gets a  '#update:with:from:'-message, with aParameter
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  1930
     and anArgument as arguments."
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1931
159
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1932
    self dependentsDo:[:dependent | 
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1933
        dependent update:aParameter with:anArgument from:self
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1934
    ]
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1935
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1936
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1937
update:aParameter
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  1938
    "the message is sent to a dependent, when one of the objects
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  1939
     on whom the receiver depends, has changed. The argument aParameter
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  1940
     is either the changed object or the argument to the #changed: message.
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  1941
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  1942
     Default behavior here is to do nothing"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1943
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1944
    ^ self
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1945
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1946
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1947
update:aParameter with:anArgument
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1948
    "dependent is notified of some change -
159
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1949
     Default is to try update:"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1950
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1951
    ^ self update:aParameter
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1952
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1953
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1954
update:aParameter with:anArgument from:sender
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1955
    "dependent is notified of some change -
159
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1956
     Default is to try update:with:"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1957
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1958
    ^ self update:aParameter with:anArgument
159
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1959
!
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1960
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1961
updateRequest
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1962
    "return true, if an update request is granted.
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1963
     Default here is to grant updates - may be used
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1964
     to lock updates if someone is making other changes
202
40ca7cc6fb9c *** empty log message ***
claus
parents: 179
diff changeset
  1965
     from within an update. Or if someone has locked its
40ca7cc6fb9c *** empty log message ***
claus
parents: 179
diff changeset
  1966
     state and does not want others to change things.
40ca7cc6fb9c *** empty log message ***
claus
parents: 179
diff changeset
  1967
     However, these dependents must all honor the
40ca7cc6fb9c *** empty log message ***
claus
parents: 179
diff changeset
  1968
     changeRequest - ifTrue - change protocol. I.e. they
40ca7cc6fb9c *** empty log message ***
claus
parents: 179
diff changeset
  1969
     must first ask all others via changeRequest, and only do the change
40ca7cc6fb9c *** empty log message ***
claus
parents: 179
diff changeset
  1970
     it returns true. The others must decide in updateRequest and
40ca7cc6fb9c *** empty log message ***
claus
parents: 179
diff changeset
  1971
     return true if they think a change is ok."
159
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1972
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1973
    ^ true
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1974
!
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1975
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1976
updateRequest:aSymbol
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1977
    "return true, if an update request is granted.
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1978
     Default here a simple updateRequest"
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1979
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1980
    ^ self updateRequest
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1981
! !
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1982
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1983
!Object methodsFor:'cleanup'!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1984
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1985
lowSpaceCleanup
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1986
    "ignored here - redefined in some classes to
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1987
     cleanup in low-memory situations"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1988
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1989
    ^ self
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1990
! !
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1991
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1992
!Object methodsFor:'comparing'!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1993
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1994
= anObject
3044
a0bbac91639b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3023
diff changeset
  1995
    "return true, if the receiver and the arg have the same structure.
a0bbac91639b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3023
diff changeset
  1996
     Notice:
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1997
        This method is partially open coded (inlined) by the compiler(s)
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1998
        identical objects are always considered equal.
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  1999
        redefining it may not work as expected."
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2000
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2001
    ^ self == anObject
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2002
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2003
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2004
== anObject
2505
3c9bf86f9e9a comment
Claus Gittinger <cg@exept.de>
parents: 2502
diff changeset
  2005
    "return true, if the receiver and the arg are the same object.
3c9bf86f9e9a comment
Claus Gittinger <cg@exept.de>
parents: 2502
diff changeset
  2006
     Never redefine this in any class.
3044
a0bbac91639b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3023
diff changeset
  2007
     Notice:
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2008
        This method is open coded (inlined) by the compiler(s)
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2009
        - redefining it may not work as expected."
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2010
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2011
%{  /* NOCONTEXT */
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2012
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2013
    RETURN ( (self == anObject) ? true : false );
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2014
%}
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2015
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2016
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2017
hash
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2018
    "return an Integer useful as a hash key for the receiver.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2019
     This hash should return same values for objects with same
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2020
     contents (i.e. use this to hash on structure)"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2021
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2022
    ^ self identityHash
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2023
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2024
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2025
identityHash
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2026
    "return an Integer useful as a hash key for the receiver.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2027
     This hash should return same values for the same object (i.e. use
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2028
     this to hash on identity of objects).
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2029
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2030
     We cannot use the Objects address (as other smalltalks do) since
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2031
     no object-table exists and the hashval must not change when objects
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2032
     are moved by the collector. Therefore we assign each object a unique
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2033
     Id in the object header itself as its hashed upon.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2034
     (luckily we have 11 bits spare to do this - unluckily its only 11 bits).
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2035
     Time will show, if 11 bits are enough; if not, another entry in the
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2036
     object header will be needed, adding 4 bytes to every object. Alternatively,
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2037
     hashed-upon objects could add an instvar containing the hash value."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2038
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2039
%{  /* NOCONTEXT */
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2040
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2041
    REGISTER unsigned hash;
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2042
    static unsigned nextHash = 0;
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2043
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2044
    if (__isNonNilObject(self)) {
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2045
        hash = __GET_HASH(self);
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2046
        if (hash == 0) {
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2047
            /* has no hash yet */
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2048
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2049
            if (++nextHash > __MAX_HASH__) {
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2050
                nextHash = 1;
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2051
            }
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2052
            hash = nextHash;
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2053
            __SET_HASH(self, hash);
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2054
        }
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2055
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2056
        /*
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2057
         * now, we got 11 bits for hashing;
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2058
         * make it as large as possible; since most hashers use the returned
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2059
         * key and take it modulo some prime number, this will allow for
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2060
         * better distribution (i.e. bigger empty spaces) in hashed collection.
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2061
         */
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2062
        hash = __MAKE_HASH__(hash);
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2063
        RETURN ( __MKSMALLINT(hash) );
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2064
    }
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2065
%}.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2066
    ^ 0 "never reached, since redefined in UndefinedObject and SmallInteger"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2067
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2068
2479
6d9c516e04d8 added special hash for binaryStorage
Claus Gittinger <cg@exept.de>
parents: 2478
diff changeset
  2069
identityHashForBinaryStore
6d9c516e04d8 added special hash for binaryStorage
Claus Gittinger <cg@exept.de>
parents: 2478
diff changeset
  2070
    "hash which is usable if the object does not change its class
6d9c516e04d8 added special hash for binaryStorage
Claus Gittinger <cg@exept.de>
parents: 2478
diff changeset
  2071
     and does not #become something else, while the hash is used.
6d9c516e04d8 added special hash for binaryStorage
Claus Gittinger <cg@exept.de>
parents: 2478
diff changeset
  2072
     This is only used by the binary storage mechanism, during the
6d9c516e04d8 added special hash for binaryStorage
Claus Gittinger <cg@exept.de>
parents: 2478
diff changeset
  2073
     object writing phase."
6d9c516e04d8 added special hash for binaryStorage
Claus Gittinger <cg@exept.de>
parents: 2478
diff changeset
  2074
6d9c516e04d8 added special hash for binaryStorage
Claus Gittinger <cg@exept.de>
parents: 2478
diff changeset
  2075
%{  /* NOCONTEXT */
6d9c516e04d8 added special hash for binaryStorage
Claus Gittinger <cg@exept.de>
parents: 2478
diff changeset
  2076
6d9c516e04d8 added special hash for binaryStorage
Claus Gittinger <cg@exept.de>
parents: 2478
diff changeset
  2077
    REGISTER unsigned hash, hash1, hash2, sz;
6d9c516e04d8 added special hash for binaryStorage
Claus Gittinger <cg@exept.de>
parents: 2478
diff changeset
  2078
    OBJ o;
6d9c516e04d8 added special hash for binaryStorage
Claus Gittinger <cg@exept.de>
parents: 2478
diff changeset
  2079
    static unsigned nextHash = 0;
2480
077b0a0f9248 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2479
diff changeset
  2080
    static unsigned nextClassHash = 0;
2479
6d9c516e04d8 added special hash for binaryStorage
Claus Gittinger <cg@exept.de>
parents: 2478
diff changeset
  2081
6d9c516e04d8 added special hash for binaryStorage
Claus Gittinger <cg@exept.de>
parents: 2478
diff changeset
  2082
    if (__isNonNilObject(self)) {
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2083
        /*
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2084
         * my own identityHash
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2085
         */
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2086
        hash1 = __GET_HASH(self);
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2087
        if (hash1 == 0) {
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2088
            /* has no hash yet */
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2089
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2090
            if (++nextHash > __MAX_HASH__) {
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2091
                nextHash = 1;
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2092
            }
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2093
            hash1 = nextHash;
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2094
            __SET_HASH(self, hash1);
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2095
        }
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2096
        /*
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2097
         * my classes identityHash
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2098
         */
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2099
        o = __qClass(self);
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2100
        hash2 = __GET_HASH(o);
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2101
        if (hash2 == 0) {
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2102
            /* has no hash yet */
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2103
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2104
            if (++nextClassHash > __MAX_HASH__) {
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2105
                nextClassHash = 1;
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2106
            }
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2107
            hash2 = nextClassHash;
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2108
            __SET_HASH(o, hash2);
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2109
        }
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2110
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2111
        /*
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2112
         * some bits of my size
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2113
         */
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2114
        sz = __qSize(self);
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2115
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2116
        /*
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2117
         * now, we got 11 + 11 + 8 bits for hashing;
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2118
         * make it as large as possible; since most hashers use the returned
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2119
         * key and take it modulo some prime number, this will allow for
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2120
         * better distribution (i.e. bigger empty spaces) in hashed collection.
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2121
         */
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2122
        hash = (hash1 << 11) | hash2;           /* 22 bits */
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2123
        hash = (hash << 8) | (sz & 0xFC);       /* 30 bits */
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2124
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2125
        while ((hash & 0x20000000) == 0) {
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2126
            hash <<= 1;
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2127
        }
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2128
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2129
        RETURN ( __MKSMALLINT(hash) );
2479
6d9c516e04d8 added special hash for binaryStorage
Claus Gittinger <cg@exept.de>
parents: 2478
diff changeset
  2130
    }
6d9c516e04d8 added special hash for binaryStorage
Claus Gittinger <cg@exept.de>
parents: 2478
diff changeset
  2131
%}.
5421
6dda4984b524 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5418
diff changeset
  2132
    "never reached, since UndefinedObject and SmallInteger are not hashed upon in binary storage"
6dda4984b524 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5418
diff changeset
  2133
    ^ self identityHash
2479
6d9c516e04d8 added special hash for binaryStorage
Claus Gittinger <cg@exept.de>
parents: 2478
diff changeset
  2134
!
6d9c516e04d8 added special hash for binaryStorage
Claus Gittinger <cg@exept.de>
parents: 2478
diff changeset
  2135
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2136
isNil
3044
a0bbac91639b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3023
diff changeset
  2137
    "return true, if the receiver is nil.
a0bbac91639b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3023
diff changeset
  2138
     Notice:
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2139
        This method is open coded (inlined) by the compiler(s)
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2140
        - redefining it may not work as expected."
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2141
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2142
    ^ false
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2143
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2144
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2145
notNil
3044
a0bbac91639b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3023
diff changeset
  2146
    "return true, if the receiver is not nil.
a0bbac91639b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3023
diff changeset
  2147
     Notice:
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2148
        This method is open coded (inlined) by the compiler(s)
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2149
        - redefining it may not work as expected."
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2150
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2151
    ^ true
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2152
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2153
3384
b0f2f2aca95f added #sameContentsAs: (helper for MessageTracer)
Claus Gittinger <cg@exept.de>
parents: 3380
diff changeset
  2154
sameContentsAs:anObject
b0f2f2aca95f added #sameContentsAs: (helper for MessageTracer)
Claus Gittinger <cg@exept.de>
parents: 3380
diff changeset
  2155
    "return true, if the receiver and the arg have the same contents
b0f2f2aca95f added #sameContentsAs: (helper for MessageTracer)
Claus Gittinger <cg@exept.de>
parents: 3380
diff changeset
  2156
     in both the named instance vars and any indexed instVars."
b0f2f2aca95f added #sameContentsAs: (helper for MessageTracer)
Claus Gittinger <cg@exept.de>
parents: 3380
diff changeset
  2157
b0f2f2aca95f added #sameContentsAs: (helper for MessageTracer)
Claus Gittinger <cg@exept.de>
parents: 3380
diff changeset
  2158
    |myClass otherClass
b0f2f2aca95f added #sameContentsAs: (helper for MessageTracer)
Claus Gittinger <cg@exept.de>
parents: 3380
diff changeset
  2159
     sz "{ Class: SmallInteger }" |
b0f2f2aca95f added #sameContentsAs: (helper for MessageTracer)
Claus Gittinger <cg@exept.de>
parents: 3380
diff changeset
  2160
b0f2f2aca95f added #sameContentsAs: (helper for MessageTracer)
Claus Gittinger <cg@exept.de>
parents: 3380
diff changeset
  2161
    myClass := self class.
b0f2f2aca95f added #sameContentsAs: (helper for MessageTracer)
Claus Gittinger <cg@exept.de>
parents: 3380
diff changeset
  2162
    myClass isVariable ifTrue:[
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2163
        sz := self basicSize.
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2164
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2165
        "compare the indexed variables"
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2166
        1 to:sz do:[:i | 
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2167
            (self basicAt:i) ~~ (anObject basicAt:i) ifTrue:[^ false].
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2168
        ]
3384
b0f2f2aca95f added #sameContentsAs: (helper for MessageTracer)
Claus Gittinger <cg@exept.de>
parents: 3380
diff changeset
  2169
    ].
b0f2f2aca95f added #sameContentsAs: (helper for MessageTracer)
Claus Gittinger <cg@exept.de>
parents: 3380
diff changeset
  2170
3385
31a7cbc6cf32 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3384
diff changeset
  2171
    "compare the instance variables"
3384
b0f2f2aca95f added #sameContentsAs: (helper for MessageTracer)
Claus Gittinger <cg@exept.de>
parents: 3380
diff changeset
  2172
    sz := myClass instSize.
b0f2f2aca95f added #sameContentsAs: (helper for MessageTracer)
Claus Gittinger <cg@exept.de>
parents: 3380
diff changeset
  2173
    1 to:sz do:[:i | 
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2174
        (self instVarAt:i) ~~ (anObject instVarAt:i) ifTrue:[^ false].
3384
b0f2f2aca95f added #sameContentsAs: (helper for MessageTracer)
Claus Gittinger <cg@exept.de>
parents: 3380
diff changeset
  2175
    ].
b0f2f2aca95f added #sameContentsAs: (helper for MessageTracer)
Claus Gittinger <cg@exept.de>
parents: 3380
diff changeset
  2176
b0f2f2aca95f added #sameContentsAs: (helper for MessageTracer)
Claus Gittinger <cg@exept.de>
parents: 3380
diff changeset
  2177
    ^ true
b0f2f2aca95f added #sameContentsAs: (helper for MessageTracer)
Claus Gittinger <cg@exept.de>
parents: 3380
diff changeset
  2178
b0f2f2aca95f added #sameContentsAs: (helper for MessageTracer)
Claus Gittinger <cg@exept.de>
parents: 3380
diff changeset
  2179
    "
b0f2f2aca95f added #sameContentsAs: (helper for MessageTracer)
Claus Gittinger <cg@exept.de>
parents: 3380
diff changeset
  2180
     #(1 2 3 4) sameContentsAsIn:#[1 2 3 4] asArray 
b0f2f2aca95f added #sameContentsAs: (helper for MessageTracer)
Claus Gittinger <cg@exept.de>
parents: 3380
diff changeset
  2181
     (1@2) sameContentsAsIn:(1->2)
b0f2f2aca95f added #sameContentsAs: (helper for MessageTracer)
Claus Gittinger <cg@exept.de>
parents: 3380
diff changeset
  2182
    "
b0f2f2aca95f added #sameContentsAs: (helper for MessageTracer)
Claus Gittinger <cg@exept.de>
parents: 3380
diff changeset
  2183
b0f2f2aca95f added #sameContentsAs: (helper for MessageTracer)
Claus Gittinger <cg@exept.de>
parents: 3380
diff changeset
  2184
    "Created: / 21.4.1998 / 15:56:40 / cg"
3385
31a7cbc6cf32 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3384
diff changeset
  2185
    "Modified: / 21.4.1998 / 15:58:15 / cg"
3384
b0f2f2aca95f added #sameContentsAs: (helper for MessageTracer)
Claus Gittinger <cg@exept.de>
parents: 3380
diff changeset
  2186
!
b0f2f2aca95f added #sameContentsAs: (helper for MessageTracer)
Claus Gittinger <cg@exept.de>
parents: 3380
diff changeset
  2187
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2188
~= anObject
3044
a0bbac91639b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3023
diff changeset
  2189
    "return true, if the receiver and the arg do not have the same structure.
a0bbac91639b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3023
diff changeset
  2190
     Notice:
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2191
        This method is partially open coded (inlined) by the compiler(s)
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2192
        identical objects are never considered unequal.
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2193
        redefining it may not work as expected."
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2194
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2195
    ^ (self = anObject) not
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2196
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2197
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2198
~~ anObject
2505
3c9bf86f9e9a comment
Claus Gittinger <cg@exept.de>
parents: 2502
diff changeset
  2199
    "return true, if the receiver and the arg are not the same object.
3c9bf86f9e9a comment
Claus Gittinger <cg@exept.de>
parents: 2502
diff changeset
  2200
     Never redefine this in any class.
3044
a0bbac91639b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3023
diff changeset
  2201
     Notice:
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2202
        This method is open coded (inlined) by the compiler(s)
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2203
        - redefining it may not work as expected."
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2204
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2205
%{  /* NOCONTEXT */
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2206
    RETURN ( (self == anObject) ? false : true );
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2207
%}
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2208
! !
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2209
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2210
!Object methodsFor:'converting'!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2211
3007
8d3e37e159c0 category change
Claus Gittinger <cg@exept.de>
parents: 3005
diff changeset
  2212
-> anObject
8d3e37e159c0 category change
Claus Gittinger <cg@exept.de>
parents: 3005
diff changeset
  2213
    "return an association with the receiver as key and
8d3e37e159c0 category change
Claus Gittinger <cg@exept.de>
parents: 3005
diff changeset
  2214
     the argument as value"
8d3e37e159c0 category change
Claus Gittinger <cg@exept.de>
parents: 3005
diff changeset
  2215
8d3e37e159c0 category change
Claus Gittinger <cg@exept.de>
parents: 3005
diff changeset
  2216
    ^ Association key:self value:anObject
8d3e37e159c0 category change
Claus Gittinger <cg@exept.de>
parents: 3005
diff changeset
  2217
!
8d3e37e159c0 category change
Claus Gittinger <cg@exept.de>
parents: 3005
diff changeset
  2218
5607
94c690ba0dea Define #asCollection, #asSequenceableCollection
Stefan Vogel <sv@exept.de>
parents: 5606
diff changeset
  2219
asCollection
94c690ba0dea Define #asCollection, #asSequenceableCollection
Stefan Vogel <sv@exept.de>
parents: 5606
diff changeset
  2220
    "return myself as a Collection.
94c690ba0dea Define #asCollection, #asSequenceableCollection
Stefan Vogel <sv@exept.de>
parents: 5606
diff changeset
  2221
     Redefined in collection to return themself."
94c690ba0dea Define #asCollection, #asSequenceableCollection
Stefan Vogel <sv@exept.de>
parents: 5606
diff changeset
  2222
94c690ba0dea Define #asCollection, #asSequenceableCollection
Stefan Vogel <sv@exept.de>
parents: 5606
diff changeset
  2223
    ^ Array with:self
94c690ba0dea Define #asCollection, #asSequenceableCollection
Stefan Vogel <sv@exept.de>
parents: 5606
diff changeset
  2224
!
94c690ba0dea Define #asCollection, #asSequenceableCollection
Stefan Vogel <sv@exept.de>
parents: 5606
diff changeset
  2225
94c690ba0dea Define #asCollection, #asSequenceableCollection
Stefan Vogel <sv@exept.de>
parents: 5606
diff changeset
  2226
asSequenceableCollection
94c690ba0dea Define #asCollection, #asSequenceableCollection
Stefan Vogel <sv@exept.de>
parents: 5606
diff changeset
  2227
    "return myself as a SequenceableCollection.
94c690ba0dea Define #asCollection, #asSequenceableCollection
Stefan Vogel <sv@exept.de>
parents: 5606
diff changeset
  2228
     Redefined in SequenceableCollection"
94c690ba0dea Define #asCollection, #asSequenceableCollection
Stefan Vogel <sv@exept.de>
parents: 5606
diff changeset
  2229
94c690ba0dea Define #asCollection, #asSequenceableCollection
Stefan Vogel <sv@exept.de>
parents: 5606
diff changeset
  2230
    ^ Array with:self
94c690ba0dea Define #asCollection, #asSequenceableCollection
Stefan Vogel <sv@exept.de>
parents: 5606
diff changeset
  2231
!
94c690ba0dea Define #asCollection, #asSequenceableCollection
Stefan Vogel <sv@exept.de>
parents: 5606
diff changeset
  2232
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2233
asValue
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2234
    "return a valueHolder for for the receiver"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2235
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2236
    ^ ValueHolder with:self
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2237
! !
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2238
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2239
!Object methodsFor:'copying'!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2240
4731
174be180114a deepCopy fixes and hooks
Claus Gittinger <cg@exept.de>
parents: 4693
diff changeset
  2241
cloneFrom:anObject 
174be180114a deepCopy fixes and hooks
Claus Gittinger <cg@exept.de>
parents: 4693
diff changeset
  2242
    "Helper for copy:
174be180114a deepCopy fixes and hooks
Claus Gittinger <cg@exept.de>
parents: 4693
diff changeset
  2243
     copy all instance variables from anObject into the receiver,
174be180114a deepCopy fixes and hooks
Claus Gittinger <cg@exept.de>
parents: 4693
diff changeset
  2244
     which should be of the same class as the argument."
174be180114a deepCopy fixes and hooks
Claus Gittinger <cg@exept.de>
parents: 4693
diff changeset
  2245
174be180114a deepCopy fixes and hooks
Claus Gittinger <cg@exept.de>
parents: 4693
diff changeset
  2246
    self cloneFrom:anObject performing:#yourself
174be180114a deepCopy fixes and hooks
Claus Gittinger <cg@exept.de>
parents: 4693
diff changeset
  2247
174be180114a deepCopy fixes and hooks
Claus Gittinger <cg@exept.de>
parents: 4693
diff changeset
  2248
    "
174be180114a deepCopy fixes and hooks
Claus Gittinger <cg@exept.de>
parents: 4693
diff changeset
  2249
     |x|
174be180114a deepCopy fixes and hooks
Claus Gittinger <cg@exept.de>
parents: 4693
diff changeset
  2250
174be180114a deepCopy fixes and hooks
Claus Gittinger <cg@exept.de>
parents: 4693
diff changeset
  2251
     x := Array new:3.
174be180114a deepCopy fixes and hooks
Claus Gittinger <cg@exept.de>
parents: 4693
diff changeset
  2252
     x cloneFrom:#(1 2 3).
174be180114a deepCopy fixes and hooks
Claus Gittinger <cg@exept.de>
parents: 4693
diff changeset
  2253
    "
174be180114a deepCopy fixes and hooks
Claus Gittinger <cg@exept.de>
parents: 4693
diff changeset
  2254
!
174be180114a deepCopy fixes and hooks
Claus Gittinger <cg@exept.de>
parents: 4693
diff changeset
  2255
174be180114a deepCopy fixes and hooks
Claus Gittinger <cg@exept.de>
parents: 4693
diff changeset
  2256
cloneFrom:anObject performing:aSymbol
174be180114a deepCopy fixes and hooks
Claus Gittinger <cg@exept.de>
parents: 4693
diff changeset
  2257
    "Helper for copy:
174be180114a deepCopy fixes and hooks
Claus Gittinger <cg@exept.de>
parents: 4693
diff changeset
  2258
     for each instance variables from anObject, send it aSymbol
174be180114a deepCopy fixes and hooks
Claus Gittinger <cg@exept.de>
parents: 4693
diff changeset
  2259
     and store the result into the receiver,
174be180114a deepCopy fixes and hooks
Claus Gittinger <cg@exept.de>
parents: 4693
diff changeset
  2260
     which should be of the same class as the argument."
174be180114a deepCopy fixes and hooks
Claus Gittinger <cg@exept.de>
parents: 4693
diff changeset
  2261
174be180114a deepCopy fixes and hooks
Claus Gittinger <cg@exept.de>
parents: 4693
diff changeset
  2262
    |myClass sz "{ Class: SmallInteger }" t |
174be180114a deepCopy fixes and hooks
Claus Gittinger <cg@exept.de>
parents: 4693
diff changeset
  2263
174be180114a deepCopy fixes and hooks
Claus Gittinger <cg@exept.de>
parents: 4693
diff changeset
  2264
    myClass := self class.
174be180114a deepCopy fixes and hooks
Claus Gittinger <cg@exept.de>
parents: 4693
diff changeset
  2265
    myClass isVariable ifTrue:[
174be180114a deepCopy fixes and hooks
Claus Gittinger <cg@exept.de>
parents: 4693
diff changeset
  2266
        sz := self basicSize.
174be180114a deepCopy fixes and hooks
Claus Gittinger <cg@exept.de>
parents: 4693
diff changeset
  2267
174be180114a deepCopy fixes and hooks
Claus Gittinger <cg@exept.de>
parents: 4693
diff changeset
  2268
        "copy the indexed variables"
174be180114a deepCopy fixes and hooks
Claus Gittinger <cg@exept.de>
parents: 4693
diff changeset
  2269
        1 to:sz do:[:i | 
174be180114a deepCopy fixes and hooks
Claus Gittinger <cg@exept.de>
parents: 4693
diff changeset
  2270
            t := anObject basicAt:i.
174be180114a deepCopy fixes and hooks
Claus Gittinger <cg@exept.de>
parents: 4693
diff changeset
  2271
            aSymbol ~~ #yourself ifTrue:[
4734
c33b5d43202a oops - shallowCopy
Claus Gittinger <cg@exept.de>
parents: 4732
diff changeset
  2272
                t := t perform:aSymbol.
c33b5d43202a oops - shallowCopy
Claus Gittinger <cg@exept.de>
parents: 4732
diff changeset
  2273
            ].
c33b5d43202a oops - shallowCopy
Claus Gittinger <cg@exept.de>
parents: 4732
diff changeset
  2274
            self basicAt:i put:t.
4731
174be180114a deepCopy fixes and hooks
Claus Gittinger <cg@exept.de>
parents: 4693
diff changeset
  2275
        ]
174be180114a deepCopy fixes and hooks
Claus Gittinger <cg@exept.de>
parents: 4693
diff changeset
  2276
    ].
174be180114a deepCopy fixes and hooks
Claus Gittinger <cg@exept.de>
parents: 4693
diff changeset
  2277
174be180114a deepCopy fixes and hooks
Claus Gittinger <cg@exept.de>
parents: 4693
diff changeset
  2278
    "copy the instance variables"
174be180114a deepCopy fixes and hooks
Claus Gittinger <cg@exept.de>
parents: 4693
diff changeset
  2279
    sz := myClass instSize.
174be180114a deepCopy fixes and hooks
Claus Gittinger <cg@exept.de>
parents: 4693
diff changeset
  2280
    1 to:sz do:[:i | 
174be180114a deepCopy fixes and hooks
Claus Gittinger <cg@exept.de>
parents: 4693
diff changeset
  2281
        t := anObject instVarAt:i.
174be180114a deepCopy fixes and hooks
Claus Gittinger <cg@exept.de>
parents: 4693
diff changeset
  2282
        aSymbol ~~ #yourself ifTrue:[
4734
c33b5d43202a oops - shallowCopy
Claus Gittinger <cg@exept.de>
parents: 4732
diff changeset
  2283
            t := t perform:aSymbol
c33b5d43202a oops - shallowCopy
Claus Gittinger <cg@exept.de>
parents: 4732
diff changeset
  2284
        ].
c33b5d43202a oops - shallowCopy
Claus Gittinger <cg@exept.de>
parents: 4732
diff changeset
  2285
        self instVarAt:i put:t
4731
174be180114a deepCopy fixes and hooks
Claus Gittinger <cg@exept.de>
parents: 4693
diff changeset
  2286
    ].
174be180114a deepCopy fixes and hooks
Claus Gittinger <cg@exept.de>
parents: 4693
diff changeset
  2287
174be180114a deepCopy fixes and hooks
Claus Gittinger <cg@exept.de>
parents: 4693
diff changeset
  2288
    ^ self
174be180114a deepCopy fixes and hooks
Claus Gittinger <cg@exept.de>
parents: 4693
diff changeset
  2289
174be180114a deepCopy fixes and hooks
Claus Gittinger <cg@exept.de>
parents: 4693
diff changeset
  2290
!
174be180114a deepCopy fixes and hooks
Claus Gittinger <cg@exept.de>
parents: 4693
diff changeset
  2291
4693
2792b6043133 New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents: 4683
diff changeset
  2292
cloneInstanceVariablesFrom:aPrototype
4731
174be180114a deepCopy fixes and hooks
Claus Gittinger <cg@exept.de>
parents: 4693
diff changeset
  2293
    "Shallow copy variables from a prototype into myself.
174be180114a deepCopy fixes and hooks
Claus Gittinger <cg@exept.de>
parents: 4693
diff changeset
  2294
     This copies instVars by name - i.e. same-named variables are
174be180114a deepCopy fixes and hooks
Claus Gittinger <cg@exept.de>
parents: 4693
diff changeset
  2295
     copied, others are not.
174be180114a deepCopy fixes and hooks
Claus Gittinger <cg@exept.de>
parents: 4693
diff changeset
  2296
     The variable slots are copied as available 
174be180114a deepCopy fixes and hooks
Claus Gittinger <cg@exept.de>
parents: 4693
diff changeset
  2297
     (i.e. the min of both indexed sizes is used)."
4693
2792b6043133 New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents: 4683
diff changeset
  2298
        
2792b6043133 New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents: 4683
diff changeset
  2299
    |myInfo otherInfo|
2792b6043133 New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents: 4683
diff changeset
  2300
2792b6043133 New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents: 4683
diff changeset
  2301
    myInfo := self class instanceVariableOffsets.
2792b6043133 New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents: 4683
diff changeset
  2302
    otherInfo := aPrototype class instanceVariableOffsets.
2792b6043133 New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents: 4683
diff changeset
  2303
    myInfo keysAndValuesDo:[:name :index | |varIndexAssoc|
2792b6043133 New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents: 4683
diff changeset
  2304
        varIndexAssoc := otherInfo at:name ifAbsent:[].
2792b6043133 New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents: 4683
diff changeset
  2305
        varIndexAssoc notNil ifTrue:[
2792b6043133 New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents: 4683
diff changeset
  2306
            self instVarAt:index put:(aPrototype instVarAt:(varIndexAssoc value))
2792b6043133 New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents: 4683
diff changeset
  2307
        ]
2792b6043133 New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents: 4683
diff changeset
  2308
    ].
2792b6043133 New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents: 4683
diff changeset
  2309
    self isVariable ifTrue:[
2792b6043133 New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents: 4683
diff changeset
  2310
        1 to:(self basicSize min:aPrototype basicSize) do:[:index |
2792b6043133 New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents: 4683
diff changeset
  2311
            self basicAt:index put:(aPrototype basicAt:index)
2792b6043133 New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents: 4683
diff changeset
  2312
        ].
2792b6043133 New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents: 4683
diff changeset
  2313
    ].
2792b6043133 New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents: 4683
diff changeset
  2314
2792b6043133 New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents: 4683
diff changeset
  2315
    "
2792b6043133 New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents: 4683
diff changeset
  2316
     Class withoutUpdatingChangesDo:[
2792b6043133 New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents: 4683
diff changeset
  2317
         Point subclass:#Point3D
2792b6043133 New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents: 4683
diff changeset
  2318
           instanceVariableNames:'z'
2792b6043133 New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents: 4683
diff changeset
  2319
           classVariableNames:''
2792b6043133 New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents: 4683
diff changeset
  2320
           poolDictionaries:''
2792b6043133 New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents: 4683
diff changeset
  2321
           category:'testing'.
2792b6043133 New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents: 4683
diff changeset
  2322
         (Point3D new cloneInstanceVariablesFrom:1@2) inspect.
2792b6043133 New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents: 4683
diff changeset
  2323
     ]
2792b6043133 New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents: 4683
diff changeset
  2324
    "
2792b6043133 New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents: 4683
diff changeset
  2325
2792b6043133 New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents: 4683
diff changeset
  2326
    "
2792b6043133 New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents: 4683
diff changeset
  2327
     Class withoutUpdatingChangesDo:[
2792b6043133 New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents: 4683
diff changeset
  2328
         Point variableSubclass:#Point3D
2792b6043133 New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents: 4683
diff changeset
  2329
           instanceVariableNames:'z'
2792b6043133 New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents: 4683
diff changeset
  2330
           classVariableNames:''
2792b6043133 New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents: 4683
diff changeset
  2331
           poolDictionaries:''
2792b6043133 New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents: 4683
diff changeset
  2332
           category:'testing'.
2792b6043133 New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents: 4683
diff changeset
  2333
         ((Point3D new:2) cloneInstanceVariablesFrom:#(1 2 3)) inspect.
2792b6043133 New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents: 4683
diff changeset
  2334
     ]
2792b6043133 New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents: 4683
diff changeset
  2335
    "
2792b6043133 New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents: 4683
diff changeset
  2336
2792b6043133 New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents: 4683
diff changeset
  2337
    "
2792b6043133 New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents: 4683
diff changeset
  2338
     |someObject|
2792b6043133 New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents: 4683
diff changeset
  2339
2792b6043133 New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents: 4683
diff changeset
  2340
     Class withoutUpdatingChangesDo:[
2792b6043133 New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents: 4683
diff changeset
  2341
         Object subclass:#TestClass1 
2792b6043133 New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents: 4683
diff changeset
  2342
           instanceVariableNames:'foo bar'
2792b6043133 New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents: 4683
diff changeset
  2343
           classVariableNames:''
2792b6043133 New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents: 4683
diff changeset
  2344
           poolDictionaries:''
2792b6043133 New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents: 4683
diff changeset
  2345
           category:'testing'.
2792b6043133 New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents: 4683
diff changeset
  2346
         someObject := TestClass1 new.
2792b6043133 New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents: 4683
diff changeset
  2347
         someObject instVarAt:1 put:'foo'; instVarAt:2 put:'bar'.
2792b6043133 New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents: 4683
diff changeset
  2348
         Object subclass:#TestClass2 
2792b6043133 New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents: 4683
diff changeset
  2349
           instanceVariableNames:'bar foo'
2792b6043133 New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents: 4683
diff changeset
  2350
           classVariableNames:''
2792b6043133 New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents: 4683
diff changeset
  2351
           poolDictionaries:''
2792b6043133 New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents: 4683
diff changeset
  2352
           category:'testing'.
2792b6043133 New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents: 4683
diff changeset
  2353
         (TestClass2 new cloneInstanceVariablesFrom:someObject) inspect.
2792b6043133 New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents: 4683
diff changeset
  2354
     ]
2792b6043133 New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents: 4683
diff changeset
  2355
    "
2792b6043133 New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents: 4683
diff changeset
  2356
2792b6043133 New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents: 4683
diff changeset
  2357
    "
4731
174be180114a deepCopy fixes and hooks
Claus Gittinger <cg@exept.de>
parents: 4693
diff changeset
  2358
     |top b b1|
174be180114a deepCopy fixes and hooks
Claus Gittinger <cg@exept.de>
parents: 4693
diff changeset
  2359
174be180114a deepCopy fixes and hooks
Claus Gittinger <cg@exept.de>
parents: 4693
diff changeset
  2360
     top := StandardSystemView new.
174be180114a deepCopy fixes and hooks
Claus Gittinger <cg@exept.de>
parents: 4693
diff changeset
  2361
     top extent:100@100.
174be180114a deepCopy fixes and hooks
Claus Gittinger <cg@exept.de>
parents: 4693
diff changeset
  2362
174be180114a deepCopy fixes and hooks
Claus Gittinger <cg@exept.de>
parents: 4693
diff changeset
  2363
     b := Button in:top.
174be180114a deepCopy fixes and hooks
Claus Gittinger <cg@exept.de>
parents: 4693
diff changeset
  2364
     b label:'hello'.
174be180114a deepCopy fixes and hooks
Claus Gittinger <cg@exept.de>
parents: 4693
diff changeset
  2365
174be180114a deepCopy fixes and hooks
Claus Gittinger <cg@exept.de>
parents: 4693
diff changeset
  2366
     b1 := ArrowButton new cloneInstanceVariablesFrom:b.
174be180114a deepCopy fixes and hooks
Claus Gittinger <cg@exept.de>
parents: 4693
diff changeset
  2367
174be180114a deepCopy fixes and hooks
Claus Gittinger <cg@exept.de>
parents: 4693
diff changeset
  2368
     top open.
174be180114a deepCopy fixes and hooks
Claus Gittinger <cg@exept.de>
parents: 4693
diff changeset
  2369
     b1 inspect
174be180114a deepCopy fixes and hooks
Claus Gittinger <cg@exept.de>
parents: 4693
diff changeset
  2370
    "
4693
2792b6043133 New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents: 4683
diff changeset
  2371
!
2792b6043133 New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents: 4683
diff changeset
  2372
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2373
copy
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2374
    "return a copy of the receiver - defaults to shallowcopy here.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2375
     Notice, that copy does not copy dependents."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2376
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2377
    ^ self shallowCopy postCopy
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2378
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2379
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2380
deepCopy
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2381
    "return a copy of the object with all subobjects also copied.
4731
174be180114a deepCopy fixes and hooks
Claus Gittinger <cg@exept.de>
parents: 4693
diff changeset
  2382
     This method DOES handle cycles/self-refs and preserves object identity; 
174be180114a deepCopy fixes and hooks
Claus Gittinger <cg@exept.de>
parents: 4693
diff changeset
  2383
     however the receivers class is not copied (to avoid the 'total' copy).
174be180114a deepCopy fixes and hooks
Claus Gittinger <cg@exept.de>
parents: 4693
diff changeset
  2384
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2385
     This deepCopy is a bit slower than the old (unsecure) one, since it
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2386
     keeps track of already copied objects. If you are sure, that your
1129
2734bcd503fe Fix typo in comment.
Stefan Vogel <sv@exept.de>
parents: 1119
diff changeset
  2387
     copied object does not include duplicates (or you do not care) and
4731
174be180114a deepCopy fixes and hooks
Claus Gittinger <cg@exept.de>
parents: 4693
diff changeset
  2388
     no cycles are involved, you can use the old simpleDeepCopy, 
174be180114a deepCopy fixes and hooks
Claus Gittinger <cg@exept.de>
parents: 4693
diff changeset
  2389
     which avoids this overhead (but may run into trouble).
174be180114a deepCopy fixes and hooks
Claus Gittinger <cg@exept.de>
parents: 4693
diff changeset
  2390
     Notice, that deepCopy does not copy dependents."
174be180114a deepCopy fixes and hooks
Claus Gittinger <cg@exept.de>
parents: 4693
diff changeset
  2391
4799
595b19e24edb re-added postDeepCopyFrom:
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
  2392
    ^ (self deepCopyUsing:(IdentityDictionary new)) postDeepCopyFrom:self
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2393
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2394
    "an example which is not handled by the old deepCopy:
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2395
    
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2396
     |a|
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2397
     a := Array new:3.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2398
     a at:3 put:a.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2399
     a deepCopy inspect
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2400
    "
1129
2734bcd503fe Fix typo in comment.
Stefan Vogel <sv@exept.de>
parents: 1119
diff changeset
  2401
4731
174be180114a deepCopy fixes and hooks
Claus Gittinger <cg@exept.de>
parents: 4693
diff changeset
  2402
    "
174be180114a deepCopy fixes and hooks
Claus Gittinger <cg@exept.de>
parents: 4693
diff changeset
  2403
     |a|
174be180114a deepCopy fixes and hooks
Claus Gittinger <cg@exept.de>
parents: 4693
diff changeset
  2404
     a := Color black onDevice:Screen current.
174be180114a deepCopy fixes and hooks
Claus Gittinger <cg@exept.de>
parents: 4693
diff changeset
  2405
     a deepCopy inspect
174be180114a deepCopy fixes and hooks
Claus Gittinger <cg@exept.de>
parents: 4693
diff changeset
  2406
    "
174be180114a deepCopy fixes and hooks
Claus Gittinger <cg@exept.de>
parents: 4693
diff changeset
  2407
1129
2734bcd503fe Fix typo in comment.
Stefan Vogel <sv@exept.de>
parents: 1119
diff changeset
  2408
    "Modified: 27.3.1996 / 16:31:20 / stefan"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2409
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2410
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2411
deepCopyError
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2412
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2413
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2414
    "raise a signal, that deepCopy is not allowed for this object"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2415
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2416
    ^ DeepCopyErrorSignal raise
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2417
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2418
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2419
deepCopyUsing:aDictionary
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2420
    "a helper for deepCopy; return a copy of the object with 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2421
     all subobjects also copied. If the to-be-copied object is in the dictionary, 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2422
     use the value found there. The class of the receiver is not copied.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2423
     This method DOES handle cycles/self references."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2424
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2425
    |myClass aCopy
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2426
     sz "{ Class: SmallInteger }" 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2427
     iOrig iCopy|
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2428
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2429
    myClass := self class.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2430
    myClass isVariable ifTrue:[
4731
174be180114a deepCopy fixes and hooks
Claus Gittinger <cg@exept.de>
parents: 4693
diff changeset
  2431
        sz := self basicSize.
174be180114a deepCopy fixes and hooks
Claus Gittinger <cg@exept.de>
parents: 4693
diff changeset
  2432
        aCopy := myClass basicNew:sz.
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2433
    ] ifFalse:[
4731
174be180114a deepCopy fixes and hooks
Claus Gittinger <cg@exept.de>
parents: 4693
diff changeset
  2434
        sz := 0.
174be180114a deepCopy fixes and hooks
Claus Gittinger <cg@exept.de>
parents: 4693
diff changeset
  2435
        aCopy := myClass basicNew
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2436
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2437
    aCopy setHashFrom:self.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2438
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2439
    aDictionary at:self put:aCopy.
143
5ebe463ba109 got rid of globals;
claus
parents: 113
diff changeset
  2440
5ebe463ba109 got rid of globals;
claus
parents: 113
diff changeset
  2441
    "
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2442
     copy indexed instvars - if any
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2443
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2444
    sz ~~ 0 ifTrue:[
4731
174be180114a deepCopy fixes and hooks
Claus Gittinger <cg@exept.de>
parents: 4693
diff changeset
  2445
        myClass isBits ifTrue:[
174be180114a deepCopy fixes and hooks
Claus Gittinger <cg@exept.de>
parents: 4693
diff changeset
  2446
            "block-copy indexed instvars"
174be180114a deepCopy fixes and hooks
Claus Gittinger <cg@exept.de>
parents: 4693
diff changeset
  2447
            aCopy replaceFrom:1 to:sz with:self startingAt:1
174be180114a deepCopy fixes and hooks
Claus Gittinger <cg@exept.de>
parents: 4693
diff changeset
  2448
        ] ifFalse:[
174be180114a deepCopy fixes and hooks
Claus Gittinger <cg@exept.de>
parents: 4693
diff changeset
  2449
            "individual deep copy the indexed variables"
174be180114a deepCopy fixes and hooks
Claus Gittinger <cg@exept.de>
parents: 4693
diff changeset
  2450
            1 to:sz do:[:i | 
174be180114a deepCopy fixes and hooks
Claus Gittinger <cg@exept.de>
parents: 4693
diff changeset
  2451
                iOrig := self basicAt:i.
174be180114a deepCopy fixes and hooks
Claus Gittinger <cg@exept.de>
parents: 4693
diff changeset
  2452
                iOrig notNil ifTrue:[
174be180114a deepCopy fixes and hooks
Claus Gittinger <cg@exept.de>
parents: 4693
diff changeset
  2453
                    (aDictionary includesKey:iOrig) ifTrue:[
174be180114a deepCopy fixes and hooks
Claus Gittinger <cg@exept.de>
parents: 4693
diff changeset
  2454
                        iCopy := aDictionary at:iOrig
174be180114a deepCopy fixes and hooks
Claus Gittinger <cg@exept.de>
parents: 4693
diff changeset
  2455
                    ] ifFalse:[
174be180114a deepCopy fixes and hooks
Claus Gittinger <cg@exept.de>
parents: 4693
diff changeset
  2456
                        iCopy := (iOrig deepCopyUsing:aDictionary) postDeepCopy
174be180114a deepCopy fixes and hooks
Claus Gittinger <cg@exept.de>
parents: 4693
diff changeset
  2457
                    ].
174be180114a deepCopy fixes and hooks
Claus Gittinger <cg@exept.de>
parents: 4693
diff changeset
  2458
                    aCopy basicAt:i put:iCopy
174be180114a deepCopy fixes and hooks
Claus Gittinger <cg@exept.de>
parents: 4693
diff changeset
  2459
                ]
174be180114a deepCopy fixes and hooks
Claus Gittinger <cg@exept.de>
parents: 4693
diff changeset
  2460
            ]
174be180114a deepCopy fixes and hooks
Claus Gittinger <cg@exept.de>
parents: 4693
diff changeset
  2461
        ]
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2462
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2463
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2464
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2465
     copy the instance variables
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2466
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2467
    sz := myClass instSize.
4731
174be180114a deepCopy fixes and hooks
Claus Gittinger <cg@exept.de>
parents: 4693
diff changeset
  2468
    1 to:sz do:[:i |
174be180114a deepCopy fixes and hooks
Claus Gittinger <cg@exept.de>
parents: 4693
diff changeset
  2469
        (self skipInstvarIndexInDeepCopy:i) ifFalse:[
174be180114a deepCopy fixes and hooks
Claus Gittinger <cg@exept.de>
parents: 4693
diff changeset
  2470
            iOrig := self instVarAt:i.
174be180114a deepCopy fixes and hooks
Claus Gittinger <cg@exept.de>
parents: 4693
diff changeset
  2471
            iOrig notNil ifTrue:[
174be180114a deepCopy fixes and hooks
Claus Gittinger <cg@exept.de>
parents: 4693
diff changeset
  2472
                (aDictionary includesKey:iOrig) ifTrue:[
174be180114a deepCopy fixes and hooks
Claus Gittinger <cg@exept.de>
parents: 4693
diff changeset
  2473
                    iCopy := aDictionary at:iOrig
174be180114a deepCopy fixes and hooks
Claus Gittinger <cg@exept.de>
parents: 4693
diff changeset
  2474
                ] ifFalse:[
174be180114a deepCopy fixes and hooks
Claus Gittinger <cg@exept.de>
parents: 4693
diff changeset
  2475
                    iCopy := (iOrig deepCopyUsing:aDictionary) postDeepCopy
174be180114a deepCopy fixes and hooks
Claus Gittinger <cg@exept.de>
parents: 4693
diff changeset
  2476
                ].
174be180114a deepCopy fixes and hooks
Claus Gittinger <cg@exept.de>
parents: 4693
diff changeset
  2477
                aCopy instVarAt:i put:iCopy
174be180114a deepCopy fixes and hooks
Claus Gittinger <cg@exept.de>
parents: 4693
diff changeset
  2478
            ]
174be180114a deepCopy fixes and hooks
Claus Gittinger <cg@exept.de>
parents: 4693
diff changeset
  2479
        ]
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2480
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2481
    ^ aCopy
4731
174be180114a deepCopy fixes and hooks
Claus Gittinger <cg@exept.de>
parents: 4693
diff changeset
  2482
174be180114a deepCopy fixes and hooks
Claus Gittinger <cg@exept.de>
parents: 4693
diff changeset
  2483
    "
174be180114a deepCopy fixes and hooks
Claus Gittinger <cg@exept.de>
parents: 4693
diff changeset
  2484
     |a b c copyOfC|
174be180114a deepCopy fixes and hooks
Claus Gittinger <cg@exept.de>
parents: 4693
diff changeset
  2485
174be180114a deepCopy fixes and hooks
Claus Gittinger <cg@exept.de>
parents: 4693
diff changeset
  2486
     a := Array with:'hello' with:'world' with:nil.
174be180114a deepCopy fixes and hooks
Claus Gittinger <cg@exept.de>
parents: 4693
diff changeset
  2487
     b := 99 @ 999.
174be180114a deepCopy fixes and hooks
Claus Gittinger <cg@exept.de>
parents: 4693
diff changeset
  2488
     a at:3 put:b.
174be180114a deepCopy fixes and hooks
Claus Gittinger <cg@exept.de>
parents: 4693
diff changeset
  2489
     c := Array with:a with:b with:a.
174be180114a deepCopy fixes and hooks
Claus Gittinger <cg@exept.de>
parents: 4693
diff changeset
  2490
174be180114a deepCopy fixes and hooks
Claus Gittinger <cg@exept.de>
parents: 4693
diff changeset
  2491
     Transcript showCR: (c at:1) == (c at:3).
174be180114a deepCopy fixes and hooks
Claus Gittinger <cg@exept.de>
parents: 4693
diff changeset
  2492
     copyOfC := c deepCopy.
174be180114a deepCopy fixes and hooks
Claus Gittinger <cg@exept.de>
parents: 4693
diff changeset
  2493
     Transcript showCR: (copyOfC at:1) == (copyOfC at:3)
174be180114a deepCopy fixes and hooks
Claus Gittinger <cg@exept.de>
parents: 4693
diff changeset
  2494
    "
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2495
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2496
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2497
postCopy
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2498
    "this is for compatibility with ST-80 code, which uses postCopy for
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2499
     cleanup after copying, while ST/X passes the original in postCopyFrom:
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2500
     (see there)"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2501
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2502
    ^ self
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2503
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2504
4731
174be180114a deepCopy fixes and hooks
Claus Gittinger <cg@exept.de>
parents: 4693
diff changeset
  2505
postDeepCopy
174be180114a deepCopy fixes and hooks
Claus Gittinger <cg@exept.de>
parents: 4693
diff changeset
  2506
    "allows for cleanup after deep copying"
174be180114a deepCopy fixes and hooks
Claus Gittinger <cg@exept.de>
parents: 4693
diff changeset
  2507
174be180114a deepCopy fixes and hooks
Claus Gittinger <cg@exept.de>
parents: 4693
diff changeset
  2508
    ^ self postCopy
174be180114a deepCopy fixes and hooks
Claus Gittinger <cg@exept.de>
parents: 4693
diff changeset
  2509
!
174be180114a deepCopy fixes and hooks
Claus Gittinger <cg@exept.de>
parents: 4693
diff changeset
  2510
4799
595b19e24edb re-added postDeepCopyFrom:
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
  2511
postDeepCopyFrom:aSource
595b19e24edb re-added postDeepCopyFrom:
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
  2512
    "allows for cleanup after deep copying"
595b19e24edb re-added postDeepCopyFrom:
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
  2513
595b19e24edb re-added postDeepCopyFrom:
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
  2514
    ^ self postDeepCopy
595b19e24edb re-added postDeepCopyFrom:
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
  2515
!
595b19e24edb re-added postDeepCopyFrom:
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
  2516
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2517
setHashFrom:anObject
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2518
    "set my identity-hash key to be the same as anObjects hash key. 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2519
     This is an ST/X speciality, which is NOT available in other (especially OT based) 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2520
     Smalltalks, and may not be available in future ST/X versions.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2521
     DO NEVER use this for normal application code."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2522
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2523
%{  /* NOCONTEXT */
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2524
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2525
    REGISTER unsigned h;
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2526
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2527
    if (__isNonNilObject(self) && __isNonNilObject(anObject)) {
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2528
        h = __GET_HASH(anObject);
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2529
        __SET_HASH(self, h);
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2530
        RETURN (self);
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2531
    }
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2532
%}.
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2533
    self primitiveFailed    "neither receiver not arg may be nil or SmallInteger"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2534
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2535
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2536
shallowCopy
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2537
    "return a copy of the object with shared subobjects (a shallow copy)
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2538
     i.e. the copy shares referenced instvars with its original."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2539
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2540
%{  /* NOCONTEXT */
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2541
    int ninsts, spc;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2542
    int sz;
3066
eb7489e8275a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3063
diff changeset
  2543
    OBJ theCopy;
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2544
    OBJ cls;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2545
    int flags;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2546
2651
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  2547
    cls = __qClass(self);
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  2548
    flags = __intVal(__ClassInstPtr(cls)->c_flags);
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  2549
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  2550
    /*
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  2551
     * bail out for special objects ..
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  2552
     */
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  2553
    if (((flags & ~ARRAYMASK) == 0)
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  2554
     && ((flags & ARRAYMASK) != WKPOINTERARRAY)) {
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2555
        sz = __qSize(self);
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2556
        __PROTECT__(self);
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2557
        __qNew(theCopy, sz);    /* OBJECT ALLOCATION */
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2558
        __UNPROTECT__(self);
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2559
        if (theCopy) {
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2560
            cls = __qClass(self);
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2561
            spc = __qSpace(theCopy);
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2562
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2563
            theCopy->o_class = cls; __STORE_SPC(theCopy, cls, spc);
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2564
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2565
            sz = sz - OHDR_SIZE;
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2566
            if (sz) {
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2567
                char *src, *dst;
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2568
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2569
                src = (char *)(__InstPtr(self)->i_instvars);
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2570
                dst = (char *)(__InstPtr(theCopy)->i_instvars);
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2571
#ifdef bcopy4
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2572
                {
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2573
                    /* care for odd-number of longs */
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2574
                    int nW = sz >> 2;
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2575
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2576
                    if (sz & 3) {
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2577
                        nW++;
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2578
                    }
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2579
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2580
                    bcopy4(src, dst, nW);
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2581
                }
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2582
#else
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2583
                bcopy(src, dst, sz);
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2584
#endif
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2585
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2586
                flags &= ARRAYMASK;
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2587
                if (flags == POINTERARRAY) {
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2588
                    ninsts = __BYTES2OBJS__(sz);
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2589
                } else {
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2590
                    ninsts = __intVal(__ClassInstPtr(cls)->c_ninstvars);
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2591
                }
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2592
                if (ninsts) {
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2593
                    do {
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2594
                        OBJ el;
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2595
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2596
                        el = __InstPtr(theCopy)->i_instvars[ninsts-1];
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2597
                        __STORE_SPC(theCopy, el, spc);
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2598
                    } while (--ninsts);
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2599
                }
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2600
            }
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2601
            RETURN (theCopy);
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2602
        }
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2603
    }
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2604
%}.
2651
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  2605
    "/ fallBack for special objects & memoryAllocation failure case
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  2606
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  2607
    ^ self slowShallowCopy
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2608
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2609
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2610
shallowCopyForFinalization
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2611
    "this is used to aquire a copy to be used for finalization -
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2612
     (the copy will get a dispose-notification; see the documentation in the Registry class)
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2613
     This method can be redefined for more efficient copying - especially for large objects."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2614
4574
bcd0132b8d49 going to rename shallowCopyForFinalization to executor
Claus Gittinger <cg@exept.de>
parents: 4558
diff changeset
  2615
    "/ going to be obsoleted by executor
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2616
    ^ self shallowCopy
4574
bcd0132b8d49 going to rename shallowCopyForFinalization to executor
Claus Gittinger <cg@exept.de>
parents: 4558
diff changeset
  2617
bcd0132b8d49 going to rename shallowCopyForFinalization to executor
Claus Gittinger <cg@exept.de>
parents: 4558
diff changeset
  2618
    "Modified: / 5.8.1999 / 14:07:16 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2619
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2620
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2621
simpleDeepCopy
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2622
    "return a copy of the object with all subobjects also copied.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2623
     This method does NOT handle cycles - but is included to allow this 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2624
     slightly faster copy in situations where it is known that
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2625
     no recursive references occur (LargeIntegers for example).
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2626
     NOTICE: you will run into trouble, when trying this with recursive
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2627
     objects (usually recursionInterrupt or memory-alert).
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2628
     This method corresponds to the 'traditional' deepCopy found in
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2629
     the Blue book."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2630
4731
174be180114a deepCopy fixes and hooks
Claus Gittinger <cg@exept.de>
parents: 4693
diff changeset
  2631
    |myClass aCopy|
174be180114a deepCopy fixes and hooks
Claus Gittinger <cg@exept.de>
parents: 4693
diff changeset
  2632
174be180114a deepCopy fixes and hooks
Claus Gittinger <cg@exept.de>
parents: 4693
diff changeset
  2633
    (myClass := self class) isVariable ifTrue:[
174be180114a deepCopy fixes and hooks
Claus Gittinger <cg@exept.de>
parents: 4693
diff changeset
  2634
        aCopy := myClass basicNew:(self basicSize).
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2635
    ] ifFalse:[
4731
174be180114a deepCopy fixes and hooks
Claus Gittinger <cg@exept.de>
parents: 4693
diff changeset
  2636
        aCopy := myClass basicNew
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2637
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2638
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2639
    "copy the instance variables"
4731
174be180114a deepCopy fixes and hooks
Claus Gittinger <cg@exept.de>
parents: 4693
diff changeset
  2640
    aCopy cloneFrom:self performing:#simpleDeepCopy.
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2641
    ^ aCopy
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2642
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2643
    "a bad example (but ST/X should survive ...)"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2644
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2645
     |a|
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2646
     a := Array new:3.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2647
     a at:3 put:a.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2648
     a simpleDeepCopy
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2649
    "
2651
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  2650
!
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  2651
4731
174be180114a deepCopy fixes and hooks
Claus Gittinger <cg@exept.de>
parents: 4693
diff changeset
  2652
skipInstvarIndexInDeepCopy:index
174be180114a deepCopy fixes and hooks
Claus Gittinger <cg@exept.de>
parents: 4693
diff changeset
  2653
    "a helper for deepCopy; only indices for which this method returns
174be180114a deepCopy fixes and hooks
Claus Gittinger <cg@exept.de>
parents: 4693
diff changeset
  2654
     false are copied in a deep copy.
174be180114a deepCopy fixes and hooks
Claus Gittinger <cg@exept.de>
parents: 4693
diff changeset
  2655
     The default is false here - which means that everything is copied.
174be180114a deepCopy fixes and hooks
Claus Gittinger <cg@exept.de>
parents: 4693
diff changeset
  2656
     Can be redefined in subclasses for partial copies"
174be180114a deepCopy fixes and hooks
Claus Gittinger <cg@exept.de>
parents: 4693
diff changeset
  2657
174be180114a deepCopy fixes and hooks
Claus Gittinger <cg@exept.de>
parents: 4693
diff changeset
  2658
    ^ false
174be180114a deepCopy fixes and hooks
Claus Gittinger <cg@exept.de>
parents: 4693
diff changeset
  2659
!
174be180114a deepCopy fixes and hooks
Claus Gittinger <cg@exept.de>
parents: 4693
diff changeset
  2660
2651
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  2661
slowShallowCopy
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  2662
    "return a copy of the object with shared subobjects (a shallow copy)
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  2663
     i.e. the copy shares referenced instvars with its original.
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  2664
     This method is only invoked as a fallback from #shallowCopy."
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  2665
4731
174be180114a deepCopy fixes and hooks
Claus Gittinger <cg@exept.de>
parents: 4693
diff changeset
  2666
    |myClass aCopy|
174be180114a deepCopy fixes and hooks
Claus Gittinger <cg@exept.de>
parents: 4693
diff changeset
  2667
174be180114a deepCopy fixes and hooks
Claus Gittinger <cg@exept.de>
parents: 4693
diff changeset
  2668
    (myClass := self class) isVariable ifTrue:[
174be180114a deepCopy fixes and hooks
Claus Gittinger <cg@exept.de>
parents: 4693
diff changeset
  2669
        aCopy := myClass basicNew:(self basicSize).
2651
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  2670
    ] ifFalse:[
4731
174be180114a deepCopy fixes and hooks
Claus Gittinger <cg@exept.de>
parents: 4693
diff changeset
  2671
        aCopy := myClass basicNew
2651
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  2672
    ].
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  2673
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  2674
    "copy the instance variables"
4731
174be180114a deepCopy fixes and hooks
Claus Gittinger <cg@exept.de>
parents: 4693
diff changeset
  2675
    aCopy cloneFrom:self performing:#yourself.
2651
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  2676
    ^ aCopy
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2677
! !
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2678
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2679
!Object methodsFor:'debugging'!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2680
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2681
basicInspect
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2682
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2683
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2684
    "launch an inspector on the receiver.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2685
     this method should NOT be redefined in subclasses."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2686
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2687
    Inspector isNil ifTrue:[
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2688
        "
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2689
         for systems without GUI
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2690
        "
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2691
        Transcript showCR:'no Inspector'
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2692
    ] ifFalse:[
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2693
        Inspector openOn:self
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2694
    ]
1417
59e7d3c1df6d showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1397
diff changeset
  2695
59e7d3c1df6d showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1397
diff changeset
  2696
    "Modified: 18.5.1996 / 15:43:25 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2697
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2698
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2699
inspect
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2700
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2701
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2702
    "launch an inspector on the receiver.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2703
     this method (or better: inspectorClass) can be redefined in subclasses 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2704
     to start special inspectors."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2705
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2706
    |cls|
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2707
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2708
    cls := self inspectorClass.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2709
    cls isNil ifTrue:[
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2710
        ^ self basicInspect
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2711
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2712
    cls openOn:self
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2713
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2714
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2715
     Object new inspect
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2716
     (1 @ 2) inspect
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2717
     Smalltalk inspect
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2718
     #(1 2 3) asOrderedCollection inspect
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2719
     (Color red) inspect
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2720
     (Image fromFile:'bitmaps/garfield.gif') inspect
143
5ebe463ba109 got rid of globals;
claus
parents: 113
diff changeset
  2721
    "
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  2722
!
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  2723
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2724
inspectorClass
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2725
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2726
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2727
    "return the class to use for inspect. 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2728
     Can (should) be redefined in classes for which a better inspector is available"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2729
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2730
    ^ Inspector
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2731
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2732
4600
050433a72954 preps for #mustBeBoolean.
Claus Gittinger <cg@exept.de>
parents: 4587
diff changeset
  2733
mustBeBoolean
050433a72954 preps for #mustBeBoolean.
Claus Gittinger <cg@exept.de>
parents: 4587
diff changeset
  2734
    "this message is sent by the VM, if a non-Boolean receiver is encountered
050433a72954 preps for #mustBeBoolean.
Claus Gittinger <cg@exept.de>
parents: 4587
diff changeset
  2735
     in an if* or while* message.
050433a72954 preps for #mustBeBoolean.
Claus Gittinger <cg@exept.de>
parents: 4587
diff changeset
  2736
     Caveat: for now, this is only sent by the interpreter;
050433a72954 preps for #mustBeBoolean.
Claus Gittinger <cg@exept.de>
parents: 4587
diff changeset
  2737
     both the JIT and the stc compiler treat it as undefined."
050433a72954 preps for #mustBeBoolean.
Claus Gittinger <cg@exept.de>
parents: 4587
diff changeset
  2738
050433a72954 preps for #mustBeBoolean.
Claus Gittinger <cg@exept.de>
parents: 4587
diff changeset
  2739
    self error:'Non boolean receiver - proceed for truth' mayProceed:true.
050433a72954 preps for #mustBeBoolean.
Claus Gittinger <cg@exept.de>
parents: 4587
diff changeset
  2740
    ^ true
050433a72954 preps for #mustBeBoolean.
Claus Gittinger <cg@exept.de>
parents: 4587
diff changeset
  2741
!
050433a72954 preps for #mustBeBoolean.
Claus Gittinger <cg@exept.de>
parents: 4587
diff changeset
  2742
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2743
mustBeKindOf:aClass
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2744
    "for compatibility & debugging support: 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2745
     check if the receiver isKindOf:aClass and raise an error if not.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2746
     Notice:
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2747
        it is VERY questionable, if it makes sense to add manual
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2748
        type checks to a dynamically typed language like smalltalk. 
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2749
        It will, at least, slow down performance,
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2750
        make your code less reusable and clutter your code with stupid sends
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2751
        of this selector. Also, read the comment in isKindOf:, regarding the
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2752
        use of isXXX check methods.
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2753
     You see: The author does not like this at all ..."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2754
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2755
    (self isKindOf:aClass) ifFalse:[
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2756
        self error:'argument is not of expected type'
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2757
    ]
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2758
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2759
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2760
obsoleteMethodWarning
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2761
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2762
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2763
    "in methods which are going to be obsoleted, a self send to
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2764
     this method is used to tell programmers that a method is
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2765
     used which is going to be removed in later ST/X versions.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2766
     Find all methods which will be obsolete soon by looking at senders
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2767
     of this message.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2768
     Hopefully, this warning message is annoying enough for you to
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2769
     change the code ... ;-)"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2770
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2771
    self obsoleteMethodWarning:nil from:thisContext sender
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2772
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2773
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2774
obsoleteMethodWarning:message
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2775
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2776
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2777
    "in methods which are going to be obsoleted, a self send to
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2778
     this method is used to tell programmers that a method is
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2779
     used which is going to be removed in later ST/X versions.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2780
     Find all methods which will be obsolete soon by looking at senders
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2781
     of this message.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2782
     Hopefully, this warning message is annoying enough for you to
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2783
     change the code ... ;-)"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2784
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2785
    self obsoleteMethodWarning:message from:thisContext sender
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2786
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2787
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2788
obsoleteMethodWarning:message from:aContext
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2789
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2790
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2791
    "in methods which are going to be obsoleted, a self-send to
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2792
     this method is used to tell programmers that a method is
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2793
     used which is going to be removed in later ST/X versions.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2794
     Find all methods which will be obsolete soon by looking at senders
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2795
     of this message.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2796
     Hopefully, this warning message is annoying enough for you to
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2797
     change the code ... ;-)"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2798
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2799
    |spec|
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2800
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2801
    spec := aContext methodPrintString.
2136
36c63754670a *PrintNL eliminated
Claus Gittinger <cg@exept.de>
parents: 2132
diff changeset
  2802
    ('WARNING: the ''' , spec , ''' method is obsolete.') errorPrintCR.
36c63754670a *PrintNL eliminated
Claus Gittinger <cg@exept.de>
parents: 2132
diff changeset
  2803
    ('         And may not be present in future ST/X versions.') errorPrintCR.
36c63754670a *PrintNL eliminated
Claus Gittinger <cg@exept.de>
parents: 2132
diff changeset
  2804
    ('         called from ' , aContext sender printString) errorPrintCR.
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2805
    message notNil ifTrue:[
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2806
        '------>  ' errorPrint. message errorPrintCR
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2807
    ]
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2808
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2809
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2810
     Object obsoleteMethodWarning:'foo' from:thisContext sender sender
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2811
    "
2136
36c63754670a *PrintNL eliminated
Claus Gittinger <cg@exept.de>
parents: 2132
diff changeset
  2812
36c63754670a *PrintNL eliminated
Claus Gittinger <cg@exept.de>
parents: 2132
diff changeset
  2813
    "Modified: 10.1.1997 / 19:08:42 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2814
! !
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2815
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2816
!Object methodsFor:'dependents access'!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2817
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2818
addDependent:anObject
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2819
    "make the argument, anObject be a dependent of the receiver"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2820
1585
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  2821
    |wasBlocked|
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  2822
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  2823
    "/ must do this save from interrupts, since the dependents collection
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  2824
    "/ is possibly accessed from multiple threads.
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  2825
    "/ Used to use #valueUninterruptably here; inlined that code for slightly
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  2826
    "/ faster execution.
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  2827
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  2828
    wasBlocked := OperatingSystem blockInterrupts.
863
2c83fe958ca7 change dependencies uninterruptably
Claus Gittinger <cg@exept.de>
parents: 861
diff changeset
  2829
    [
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2830
        |deps dep|
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2831
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2832
        deps := self dependents.
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2833
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2834
        "/ to save a fair amount of memory in case of
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2835
        "/ many dependencies, we store a single dependent in
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2836
        "/ a WeakArray, and switch to a WeakSet if more dependents are
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2837
        "/ added.
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2838
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2839
        (deps isNil or:[deps size == 0]) ifTrue:[
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2840
            self dependents:(WeakArray with:anObject)
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2841
        ] ifFalse:[
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2842
            deps class == WeakArray ifTrue:[
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2843
                dep := deps at:1.
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2844
                dep ~~ anObject ifTrue:[
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2845
                    (dep isNil or:[dep == 0]) ifTrue:[
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2846
                        deps at:1 put:anObject
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2847
                    ] ifFalse:[
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2848
                        self dependents:(WeakIdentitySet with:dep with:anObject)
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2849
                    ]
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2850
                ]
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2851
            ] ifFalse:[
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2852
                deps add:anObject
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2853
            ]
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2854
        ]
1585
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  2855
    ] valueNowOrOnUnwindDo:[
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2856
        wasBlocked ifFalse:[
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2857
            OperatingSystem unblockInterrupts
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2858
        ]
1585
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  2859
    ]
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  2860
3063
d4bc0c596b98 dependents always returns a collection.
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
  2861
    "Modified: / 27.10.1997 / 19:35:52 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2862
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2863
3309
3e24bdf9ba79 Define #breakDependents (ST80 compat, needed by STBroker).
Stefan Vogel <sv@exept.de>
parents: 3306
diff changeset
  2864
breakDependents
3e24bdf9ba79 Define #breakDependents (ST80 compat, needed by STBroker).
Stefan Vogel <sv@exept.de>
parents: 3306
diff changeset
  2865
    "remove all dependencies from the receiver"
3e24bdf9ba79 Define #breakDependents (ST80 compat, needed by STBroker).
Stefan Vogel <sv@exept.de>
parents: 3306
diff changeset
  2866
3e24bdf9ba79 Define #breakDependents (ST80 compat, needed by STBroker).
Stefan Vogel <sv@exept.de>
parents: 3306
diff changeset
  2867
    self dependents:nil.
3e24bdf9ba79 Define #breakDependents (ST80 compat, needed by STBroker).
Stefan Vogel <sv@exept.de>
parents: 3306
diff changeset
  2868
    self nonWeakDependents:nil
3e24bdf9ba79 Define #breakDependents (ST80 compat, needed by STBroker).
Stefan Vogel <sv@exept.de>
parents: 3306
diff changeset
  2869
3e24bdf9ba79 Define #breakDependents (ST80 compat, needed by STBroker).
Stefan Vogel <sv@exept.de>
parents: 3306
diff changeset
  2870
    "Modified: / 19.4.1996 / 10:55:36 / cg"
3e24bdf9ba79 Define #breakDependents (ST80 compat, needed by STBroker).
Stefan Vogel <sv@exept.de>
parents: 3306
diff changeset
  2871
    "Created: / 27.2.1998 / 11:26:11 / stefan"
3e24bdf9ba79 Define #breakDependents (ST80 compat, needed by STBroker).
Stefan Vogel <sv@exept.de>
parents: 3306
diff changeset
  2872
!
3e24bdf9ba79 Define #breakDependents (ST80 compat, needed by STBroker).
Stefan Vogel <sv@exept.de>
parents: 3306
diff changeset
  2873
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2874
dependents
3222
f5f820763b97 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3177
diff changeset
  2875
    "return a Collection of dependents.
1231
4f457f654e57 interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  2876
     The default implementation here uses a global WeakDictionary to store
4f457f654e57 interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  2877
     dependents 
4f457f654e57 interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  2878
     This may be too slow for high frequency change&update,
4f457f654e57 interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  2879
     therefore, some classes (Model) redefine this for better performance.
4f457f654e57 interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  2880
     Notice the mentioning of a WeakDictionary - read the classes documentation."
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2881
3222
f5f820763b97 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3177
diff changeset
  2882
    |deps|
f5f820763b97 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3177
diff changeset
  2883
f5f820763b97 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3177
diff changeset
  2884
    (deps := Dependencies at:self ifAbsent:nil) isNil ifTrue:[
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2885
        ^ #().
3222
f5f820763b97 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3177
diff changeset
  2886
    ].
f5f820763b97 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3177
diff changeset
  2887
    ^ deps
f5f820763b97 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3177
diff changeset
  2888
f5f820763b97 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3177
diff changeset
  2889
    "Modified: / 26.1.1998 / 11:18:15 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2890
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2891
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2892
dependents:aCollection
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2893
    "set the collection of dependents.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2894
     The default implementation here uses a global Dictionary to store
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2895
     dependents which may be too slow for high frequency change&update.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2896
     Therefore, some classes (Model) redefine this for better performance."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2897
1624
50c5849dc9d4 mhmh - care for dependent being already in the array,
Claus Gittinger <cg@exept.de>
parents: 1611
diff changeset
  2898
    "/ must do this save from interrupts, since the dependents collection
50c5849dc9d4 mhmh - care for dependent being already in the array,
Claus Gittinger <cg@exept.de>
parents: 1611
diff changeset
  2899
    "/ is possibly accessed from multiple threads.
50c5849dc9d4 mhmh - care for dependent being already in the array,
Claus Gittinger <cg@exept.de>
parents: 1611
diff changeset
  2900
    "/ Used to use #valueUninterruptably here; inlined that code for slightly
2336
45f63b0d8832 tuned #dependents:
Claus Gittinger <cg@exept.de>
parents: 2327
diff changeset
  2901
    "/ faster execution (and to avoid creation of garbage blocks).
45f63b0d8832 tuned #dependents:
Claus Gittinger <cg@exept.de>
parents: 2327
diff changeset
  2902
45f63b0d8832 tuned #dependents:
Claus Gittinger <cg@exept.de>
parents: 2327
diff changeset
  2903
    (OperatingSystem blockInterrupts) ifTrue:[
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2904
        "/ the common case - already blocked
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2905
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2906
        (aCollection isNil or:[aCollection isEmpty]) ifTrue:[
5424
3ffaef20cfd0 removeKey:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 5421
diff changeset
  2907
            Dependencies removeKey:self ifAbsent:nil
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2908
        ] ifFalse:[
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2909
            Dependencies at:self put:aCollection
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2910
        ].
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2911
        ^ self
2336
45f63b0d8832 tuned #dependents:
Claus Gittinger <cg@exept.de>
parents: 2327
diff changeset
  2912
    ].
45f63b0d8832 tuned #dependents:
Claus Gittinger <cg@exept.de>
parents: 2327
diff changeset
  2913
863
2c83fe958ca7 change dependencies uninterruptably
Claus Gittinger <cg@exept.de>
parents: 861
diff changeset
  2914
    [
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2915
        (aCollection isNil or:[aCollection isEmpty]) ifTrue:[
5424
3ffaef20cfd0 removeKey:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 5421
diff changeset
  2916
            Dependencies removeKey:self ifAbsent:nil
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2917
        ] ifFalse:[
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2918
            Dependencies at:self put:aCollection
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2919
        ].
1624
50c5849dc9d4 mhmh - care for dependent being already in the array,
Claus Gittinger <cg@exept.de>
parents: 1611
diff changeset
  2920
    ] valueNowOrOnUnwindDo:[
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2921
        OperatingSystem unblockInterrupts
1624
50c5849dc9d4 mhmh - care for dependent being already in the array,
Claus Gittinger <cg@exept.de>
parents: 1611
diff changeset
  2922
    ]
50c5849dc9d4 mhmh - care for dependent being already in the array,
Claus Gittinger <cg@exept.de>
parents: 1611
diff changeset
  2923
2336
45f63b0d8832 tuned #dependents:
Claus Gittinger <cg@exept.de>
parents: 2327
diff changeset
  2924
    "Modified: 30.1.1997 / 21:22:10 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2925
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2926
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2927
dependentsDo:aBlock
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2928
    "evaluate aBlock for all of my dependents"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2929
1231
4f457f654e57 interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  2930
    |deps nwDeps|
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2931
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2932
    deps := self dependents.
3222
f5f820763b97 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3177
diff changeset
  2933
    deps size ~~ 0 ifTrue:[
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2934
        deps do:[:d | 
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2935
                    (d notNil and:[d ~~ 0]) ifTrue:[
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2936
                        aBlock value:d
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2937
                    ]
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2938
                ]
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2939
    ].
1231
4f457f654e57 interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  2940
    nwDeps := self nonWeakDependents.
3254
40b21297d9ab #interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents: 3228
diff changeset
  2941
    (nwDeps ~~ deps and:[nwDeps size ~~ 0]) ifTrue:[
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2942
        nwDeps do:aBlock 
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2943
    ].
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2944
3254
40b21297d9ab #interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents: 3228
diff changeset
  2945
    "Modified: / 30.1.1998 / 14:03:40 / cg"
1098
e8543399e2a0 support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents: 1097
diff changeset
  2946
!
e8543399e2a0 support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents: 1097
diff changeset
  2947
2445
efd1b24db615 added #myDependents
ca
parents: 2437
diff changeset
  2948
myDependents
efd1b24db615 added #myDependents
ca
parents: 2437
diff changeset
  2949
    "same as dependents - ST-80 compatibility"
efd1b24db615 added #myDependents
ca
parents: 2437
diff changeset
  2950
efd1b24db615 added #myDependents
ca
parents: 2437
diff changeset
  2951
    ^ self dependents
efd1b24db615 added #myDependents
ca
parents: 2437
diff changeset
  2952
!
efd1b24db615 added #myDependents
ca
parents: 2437
diff changeset
  2953
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2954
release
3309
3e24bdf9ba79 Define #breakDependents (ST80 compat, needed by STBroker).
Stefan Vogel <sv@exept.de>
parents: 3306
diff changeset
  2955
    "remove all references to objects that may refer to self.
3e24bdf9ba79 Define #breakDependents (ST80 compat, needed by STBroker).
Stefan Vogel <sv@exept.de>
parents: 3306
diff changeset
  2956
     Subclasses may redefine this method but should do a 'super release'."
3e24bdf9ba79 Define #breakDependents (ST80 compat, needed by STBroker).
Stefan Vogel <sv@exept.de>
parents: 3306
diff changeset
  2957
3e24bdf9ba79 Define #breakDependents (ST80 compat, needed by STBroker).
Stefan Vogel <sv@exept.de>
parents: 3306
diff changeset
  2958
    self breakDependents
3e24bdf9ba79 Define #breakDependents (ST80 compat, needed by STBroker).
Stefan Vogel <sv@exept.de>
parents: 3306
diff changeset
  2959
3e24bdf9ba79 Define #breakDependents (ST80 compat, needed by STBroker).
Stefan Vogel <sv@exept.de>
parents: 3306
diff changeset
  2960
    "Modified: / 27.2.1998 / 11:29:35 / stefan"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2961
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2962
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2963
removeDependent:anObject
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2964
    "make the argument, anObject be independent of the receiver"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2965
1585
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  2966
    |wasBlocked|
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  2967
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  2968
    "/ must do this save from interrupts, since the dependents collection
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  2969
    "/ is possibly accessed from multiple threads.
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  2970
    "/ Used to use #valueUninterruptably here; inlined that code for slightly
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  2971
    "/ faster execution.
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  2972
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  2973
    wasBlocked := OperatingSystem blockInterrupts.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2974
    [
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2975
        |deps n d|
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2976
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2977
        deps := self dependents.
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2978
        deps size ~~ 0 ifTrue:[
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2979
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2980
            "/ to save a fair amount of memory in case of
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2981
            "/ many dependencies, we store a single dependent in
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2982
            "/ a WeakArray, and switch to a WeakSet if more dependents are
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2983
            "/ added. Here we have to do the inverse ...
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2984
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2985
            deps class == WeakArray ifTrue:[
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2986
                ((d := deps at:1) == anObject 
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2987
                or:[d isNil
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2988
                or:[d == 0]]) ifTrue:[
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2989
                    self dependents:nil
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2990
                ]
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2991
            ] ifFalse:[
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2992
                deps remove:anObject ifAbsent:[].
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2993
                (n := deps size) == 0 ifTrue:[
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2994
                    self dependents:nil
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2995
                ] ifFalse:[
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2996
                    n == 1 ifTrue:[
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2997
                        d := deps firstIfEmpty:nil.
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2998
                        d notNil ifTrue:[
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  2999
                            deps := WeakArray with:d
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  3000
                        ] ifFalse:[
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  3001
                            deps := nil
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  3002
                        ].
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  3003
                        self dependents:deps.
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  3004
                    ]
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  3005
                ]
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  3006
            ]
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  3007
        ]
1585
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  3008
    ] valueNowOrOnUnwindDo:[
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  3009
        wasBlocked ifFalse:[
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  3010
            OperatingSystem unblockInterrupts
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  3011
        ]
1585
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  3012
    ]
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  3013
3228
b6b893e8f898 must look for size of value returned by self dependents
Claus Gittinger <cg@exept.de>
parents: 3222
diff changeset
  3014
    "Modified: / 26.1.1998 / 19:51:50 / cg"
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3015
! !
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3016
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3017
!Object methodsFor:'dependents access (nonWeak)'!
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3018
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3019
addNonWeakDependent:anObject
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3020
    "make the argument, anObject be a nonWeak dependent of the receiver.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3021
     Be careful: this nonWeakDependency will prevent the dependent from being 
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3022
     garbage collected unless the dependency is removed.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3023
     This is a private mechanism, for directed dependencies."
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3024
1585
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  3025
    |wasBlocked|
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  3026
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  3027
    "/ must do this save from interrupts, since the dependents collection
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  3028
    "/ is possibly accessed from multiple threads.
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  3029
    "/ Used to use #valueUninterruptably here; inlined that code for slightly
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  3030
    "/ faster execution.
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  3031
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  3032
    wasBlocked := OperatingSystem blockInterrupts.
863
2c83fe958ca7 change dependencies uninterruptably
Claus Gittinger <cg@exept.de>
parents: 861
diff changeset
  3033
    [
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  3034
        |deps dep|
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  3035
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  3036
        deps := self nonWeakDependents.
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  3037
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  3038
        "/ to save a fair amount of memory in case of
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  3039
        "/ many dependencies, we store a single dependent in
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  3040
        "/ an Array, and switch to a Set if more dependents are
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  3041
        "/ added.
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  3042
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  3043
        deps size == 0 ifTrue:[
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  3044
            self nonWeakDependents:(Array with:anObject)
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  3045
        ] ifFalse:[
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  3046
            deps class == Array ifTrue:[
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  3047
                dep := deps at:1.
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  3048
                dep ~~ anObject ifTrue:[
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  3049
                    self nonWeakDependents:(IdentitySet with:dep with:anObject)
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  3050
                ]
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  3051
            ] ifFalse:[
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  3052
                deps add:anObject
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  3053
            ]
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  3054
        ]
1585
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  3055
    ] valueNowOrOnUnwindDo:[
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  3056
        wasBlocked ifFalse:[
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  3057
            OperatingSystem unblockInterrupts
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  3058
        ]
1585
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  3059
    ]
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3060
3254
40b21297d9ab #interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents: 3228
diff changeset
  3061
    "Created: / 19.4.1996 / 10:54:08 / cg"
40b21297d9ab #interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents: 3228
diff changeset
  3062
    "Modified: / 30.1.1998 / 14:03:08 / cg"
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3063
!
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3064
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3065
nonWeakDependents
3254
40b21297d9ab #interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents: 3228
diff changeset
  3066
    "return a Collection of nonWeakDependents - empty if there is none.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3067
     This is a private mechanism for directed dependencies."
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3068
3254
40b21297d9ab #interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents: 3228
diff changeset
  3069
    NonWeakDependencies isNil ifTrue:[^ #()].
40b21297d9ab #interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents: 3228
diff changeset
  3070
    ^ NonWeakDependencies at:self ifAbsent:#()
40b21297d9ab #interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents: 3228
diff changeset
  3071
40b21297d9ab #interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents: 3228
diff changeset
  3072
    "Created: / 19.4.1996 / 10:55:06 / cg"
40b21297d9ab #interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents: 3228
diff changeset
  3073
    "Modified: / 30.1.1998 / 14:06:47 / cg"
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3074
!
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3075
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3076
nonWeakDependents:aCollection
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3077
    "set the collection of nonWeak dependents.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3078
     This is a private helper for directed dependencies."
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3079
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3080
    [
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  3081
        (aCollection isNil or:[aCollection isEmpty]) ifTrue:[
5424
3ffaef20cfd0 removeKey:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 5421
diff changeset
  3082
            NonWeakDependencies removeKey:self ifAbsent:nil
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  3083
        ] ifFalse:[
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  3084
            NonWeakDependencies at:self put:aCollection
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  3085
        ]
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3086
    ] valueUninterruptably
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3087
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3088
    "Created: 19.4.1996 / 11:07:47 / cg"
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3089
!
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3090
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3091
removeNonWeakDependent:anObject
1231
4f457f654e57 interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  3092
    "remove a nonWeak dependency from the receiver to the argument, anObject.
4f457f654e57 interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  3093
     (i.e. make it independent of the receiver)"
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3094
1585
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  3095
    |wasBlocked|
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  3096
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  3097
    "/ must do this save from interrupts, since the dependents collection
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  3098
    "/ is possibly accessed from multiple threads.
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  3099
    "/ Used to use #valueUninterruptably here; inlined that code for slightly
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  3100
    "/ faster execution.
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  3101
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  3102
    wasBlocked := OperatingSystem blockInterrupts.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3103
    [
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  3104
        |deps n|
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  3105
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  3106
        deps := self nonWeakDependents.
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  3107
        deps size ~~ 0 ifTrue:[
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  3108
            deps class == Array ifTrue:[
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  3109
                (deps at:1) == anObject ifTrue:[
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  3110
                    self nonWeakDependents:nil
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  3111
                ]
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  3112
            ] ifFalse:[
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  3113
                deps remove:anObject ifAbsent:[].
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  3114
                (n := deps size) == 0 ifTrue:[
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  3115
                    self nonWeakDependents:nil
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  3116
                ] ifFalse:[
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  3117
                    n == 1 ifTrue:[
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  3118
                        self nonWeakDependents:(Array with:(deps first))
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  3119
                    ]
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  3120
                ]
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  3121
            ]
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  3122
        ]
1585
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  3123
    ] valueNowOrOnUnwindDo:[
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  3124
        wasBlocked ifFalse:[
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  3125
            OperatingSystem unblockInterrupts
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  3126
        ]
1585
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  3127
    ]
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3128
3254
40b21297d9ab #interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents: 3228
diff changeset
  3129
    "Created: / 19.4.1996 / 11:44:44 / cg"
40b21297d9ab #interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents: 3228
diff changeset
  3130
    "Modified: / 30.1.1998 / 14:04:01 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3131
! !
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3132
3023
674376809496 general listView support (#displayOn / widthOn / heightOn)
ca
parents: 3010
diff changeset
  3133
!Object methodsFor:'displaying'!
674376809496 general listView support (#displayOn / widthOn / heightOn)
ca
parents: 3010
diff changeset
  3134
674376809496 general listView support (#displayOn / widthOn / heightOn)
ca
parents: 3010
diff changeset
  3135
displayOn:aGC
674376809496 general listView support (#displayOn / widthOn / heightOn)
ca
parents: 3010
diff changeset
  3136
    "ST-80 Compatibility
674376809496 general listView support (#displayOn / widthOn / heightOn)
ca
parents: 3010
diff changeset
  3137
     display the receiver in a graphicsContext at 0@0
674376809496 general listView support (#displayOn / widthOn / heightOn)
ca
parents: 3010
diff changeset
  3138
     - this method allows for any object to be displayed in some view
674376809496 general listView support (#displayOn / widthOn / heightOn)
ca
parents: 3010
diff changeset
  3139
     (although the fallBack is to display its printString ...)"
674376809496 general listView support (#displayOn / widthOn / heightOn)
ca
parents: 3010
diff changeset
  3140
674376809496 general listView support (#displayOn / widthOn / heightOn)
ca
parents: 3010
diff changeset
  3141
    ^ self displayOn:aGC x:0 y:0.
674376809496 general listView support (#displayOn / widthOn / heightOn)
ca
parents: 3010
diff changeset
  3142
674376809496 general listView support (#displayOn / widthOn / heightOn)
ca
parents: 3010
diff changeset
  3143
    "Created: 29.5.1996 / 16:28:58 / cg"
674376809496 general listView support (#displayOn / widthOn / heightOn)
ca
parents: 3010
diff changeset
  3144
!
674376809496 general listView support (#displayOn / widthOn / heightOn)
ca
parents: 3010
diff changeset
  3145
674376809496 general listView support (#displayOn / widthOn / heightOn)
ca
parents: 3010
diff changeset
  3146
displayOn:aGC at:aPoint
674376809496 general listView support (#displayOn / widthOn / heightOn)
ca
parents: 3010
diff changeset
  3147
    "ST-80 Compatibility
674376809496 general listView support (#displayOn / widthOn / heightOn)
ca
parents: 3010
diff changeset
  3148
     display the receiver in a graphicsContext - this method allows
674376809496 general listView support (#displayOn / widthOn / heightOn)
ca
parents: 3010
diff changeset
  3149
     for any object to be displayed in a ListView - for example."
674376809496 general listView support (#displayOn / widthOn / heightOn)
ca
parents: 3010
diff changeset
  3150
674376809496 general listView support (#displayOn / widthOn / heightOn)
ca
parents: 3010
diff changeset
  3151
    ^ self displayOn:aGC x:(aPoint x) y:(aPoint y).
674376809496 general listView support (#displayOn / widthOn / heightOn)
ca
parents: 3010
diff changeset
  3152
!
674376809496 general listView support (#displayOn / widthOn / heightOn)
ca
parents: 3010
diff changeset
  3153
674376809496 general listView support (#displayOn / widthOn / heightOn)
ca
parents: 3010
diff changeset
  3154
displayOn:aGC x:x y:y
674376809496 general listView support (#displayOn / widthOn / heightOn)
ca
parents: 3010
diff changeset
  3155
    "display the receiver in a graphicsContext - this method allows
674376809496 general listView support (#displayOn / widthOn / heightOn)
ca
parents: 3010
diff changeset
  3156
     for any object to be displayed in a ListView - for example."
674376809496 general listView support (#displayOn / widthOn / heightOn)
ca
parents: 3010
diff changeset
  3157
674376809496 general listView support (#displayOn / widthOn / heightOn)
ca
parents: 3010
diff changeset
  3158
    self displayOn:aGC x:x y:y opaque:false
674376809496 general listView support (#displayOn / widthOn / heightOn)
ca
parents: 3010
diff changeset
  3159
674376809496 general listView support (#displayOn / widthOn / heightOn)
ca
parents: 3010
diff changeset
  3160
    "Modified: 29.5.1996 / 16:29:38 / cg"
674376809496 general listView support (#displayOn / widthOn / heightOn)
ca
parents: 3010
diff changeset
  3161
!
674376809496 general listView support (#displayOn / widthOn / heightOn)
ca
parents: 3010
diff changeset
  3162
674376809496 general listView support (#displayOn / widthOn / heightOn)
ca
parents: 3010
diff changeset
  3163
displayOn:aGc x:x y:y opaque:opaque
674376809496 general listView support (#displayOn / widthOn / heightOn)
ca
parents: 3010
diff changeset
  3164
    "display the receiver in a graphicsContext - this method allows
674376809496 general listView support (#displayOn / widthOn / heightOn)
ca
parents: 3010
diff changeset
  3165
     for any object to be displayed in a ListView - for example.
674376809496 general listView support (#displayOn / widthOn / heightOn)
ca
parents: 3010
diff changeset
  3166
     The fallBack here shows the receivers displayString."
674376809496 general listView support (#displayOn / widthOn / heightOn)
ca
parents: 3010
diff changeset
  3167
5615
17f5326c1072 fixed displayOn
martin
parents: 5607
diff changeset
  3168
    |s yBaseline|
3023
674376809496 general listView support (#displayOn / widthOn / heightOn)
ca
parents: 3010
diff changeset
  3169
674376809496 general listView support (#displayOn / widthOn / heightOn)
ca
parents: 3010
diff changeset
  3170
    s := self displayString.
5616
3ca3f5f56eae oops - fix in displayOn breaks dataSet ... (sigh)
Claus Gittinger <cg@exept.de>
parents: 5615
diff changeset
  3171
    "/ although correct, this breaks DataSet, and it must be fixed
3ca3f5f56eae oops - fix in displayOn breaks dataSet ... (sigh)
Claus Gittinger <cg@exept.de>
parents: 5615
diff changeset
  3172
    "/ there first ...
5615
17f5326c1072 fixed displayOn
martin
parents: 5607
diff changeset
  3173
    yBaseline := y + aGc font ascent.
5616
3ca3f5f56eae oops - fix in displayOn breaks dataSet ... (sigh)
Claus Gittinger <cg@exept.de>
parents: 5615
diff changeset
  3174
    yBaseline := y "+ aGc font ascent".
3023
674376809496 general listView support (#displayOn / widthOn / heightOn)
ca
parents: 3010
diff changeset
  3175
    opaque ifTrue:[
5615
17f5326c1072 fixed displayOn
martin
parents: 5607
diff changeset
  3176
        aGc displayOpaqueString:s x:x y:yBaseline.
3023
674376809496 general listView support (#displayOn / widthOn / heightOn)
ca
parents: 3010
diff changeset
  3177
    ] ifFalse:[
5615
17f5326c1072 fixed displayOn
martin
parents: 5607
diff changeset
  3178
        aGc displayString:s x:x y:yBaseline.
3023
674376809496 general listView support (#displayOn / widthOn / heightOn)
ca
parents: 3010
diff changeset
  3179
    ].
674376809496 general listView support (#displayOn / widthOn / heightOn)
ca
parents: 3010
diff changeset
  3180
674376809496 general listView support (#displayOn / widthOn / heightOn)
ca
parents: 3010
diff changeset
  3181
    "Modified: 29.5.1996 / 16:29:38 / cg"
674376809496 general listView support (#displayOn / widthOn / heightOn)
ca
parents: 3010
diff changeset
  3182
!
674376809496 general listView support (#displayOn / widthOn / heightOn)
ca
parents: 3010
diff changeset
  3183
3063
d4bc0c596b98 dependents always returns a collection.
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
  3184
displayOpaqueOn:aGC x:x y:y
d4bc0c596b98 dependents always returns a collection.
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
  3185
    "display the receiver in a graphicsContext - this method allows
d4bc0c596b98 dependents always returns a collection.
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
  3186
     for any object to be displayed in a ListView - for example."
d4bc0c596b98 dependents always returns a collection.
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
  3187
d4bc0c596b98 dependents always returns a collection.
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
  3188
    self displayOn:aGC x:x y:y opaque:true
d4bc0c596b98 dependents always returns a collection.
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
  3189
d4bc0c596b98 dependents always returns a collection.
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
  3190
    "Modified: / 29.5.1996 / 16:29:38 / cg"
d4bc0c596b98 dependents always returns a collection.
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
  3191
    "Created: / 26.10.1997 / 15:01:36 / cg"
d4bc0c596b98 dependents always returns a collection.
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
  3192
!
d4bc0c596b98 dependents always returns a collection.
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
  3193
3023
674376809496 general listView support (#displayOn / widthOn / heightOn)
ca
parents: 3010
diff changeset
  3194
displayString
674376809496 general listView support (#displayOn / widthOn / heightOn)
ca
parents: 3010
diff changeset
  3195
    "return a string used when displaying the receiver in a view;
674376809496 general listView support (#displayOn / widthOn / heightOn)
ca
parents: 3010
diff changeset
  3196
     for example an Inspector. This is usually the same as printString,
674376809496 general listView support (#displayOn / widthOn / heightOn)
ca
parents: 3010
diff changeset
  3197
     but sometimes redefined for a better look."
674376809496 general listView support (#displayOn / widthOn / heightOn)
ca
parents: 3010
diff changeset
  3198
674376809496 general listView support (#displayOn / widthOn / heightOn)
ca
parents: 3010
diff changeset
  3199
    ^ self printString
674376809496 general listView support (#displayOn / widthOn / heightOn)
ca
parents: 3010
diff changeset
  3200
674376809496 general listView support (#displayOn / widthOn / heightOn)
ca
parents: 3010
diff changeset
  3201
    "
674376809496 general listView support (#displayOn / widthOn / heightOn)
ca
parents: 3010
diff changeset
  3202
     #(1 2 3) printString    
674376809496 general listView support (#displayOn / widthOn / heightOn)
ca
parents: 3010
diff changeset
  3203
     #(1 2 3) displayString  
674376809496 general listView support (#displayOn / widthOn / heightOn)
ca
parents: 3010
diff changeset
  3204
     #(1 2 3) storeString
674376809496 general listView support (#displayOn / widthOn / heightOn)
ca
parents: 3010
diff changeset
  3205
    "
674376809496 general listView support (#displayOn / widthOn / heightOn)
ca
parents: 3010
diff changeset
  3206
!
674376809496 general listView support (#displayOn / widthOn / heightOn)
ca
parents: 3010
diff changeset
  3207
674376809496 general listView support (#displayOn / widthOn / heightOn)
ca
parents: 3010
diff changeset
  3208
heightOn:aGC
674376809496 general listView support (#displayOn / widthOn / heightOn)
ca
parents: 3010
diff changeset
  3209
    "return the height of the receiver, if it is to be displayed on aGC"
674376809496 general listView support (#displayOn / widthOn / heightOn)
ca
parents: 3010
diff changeset
  3210
4603
fdd11551483d #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 4600
diff changeset
  3211
    ^ (aGC font onDevice:aGC device) heightOf:(self displayString)
3023
674376809496 general listView support (#displayOn / widthOn / heightOn)
ca
parents: 3010
diff changeset
  3212
!
674376809496 general listView support (#displayOn / widthOn / heightOn)
ca
parents: 3010
diff changeset
  3213
674376809496 general listView support (#displayOn / widthOn / heightOn)
ca
parents: 3010
diff changeset
  3214
widthOn:aGC
674376809496 general listView support (#displayOn / widthOn / heightOn)
ca
parents: 3010
diff changeset
  3215
    "return the width of the receiver, if it is to be displayed on aGC"
674376809496 general listView support (#displayOn / widthOn / heightOn)
ca
parents: 3010
diff changeset
  3216
4603
fdd11551483d #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 4600
diff changeset
  3217
    ^ (aGC font onDevice:aGC device) widthOf:(self displayString)
3023
674376809496 general listView support (#displayOn / widthOn / heightOn)
ca
parents: 3010
diff changeset
  3218
! !
674376809496 general listView support (#displayOn / widthOn / heightOn)
ca
parents: 3010
diff changeset
  3219
4808
Claus Gittinger <cg@exept.de>
parents: 4799
diff changeset
  3220
!Object methodsFor:'encoding & decoding'!
Claus Gittinger <cg@exept.de>
parents: 4799
diff changeset
  3221
Claus Gittinger <cg@exept.de>
parents: 4799
diff changeset
  3222
decodeAsLiteralArray
Claus Gittinger <cg@exept.de>
parents: 4799
diff changeset
  3223
    ^ self
Claus Gittinger <cg@exept.de>
parents: 4799
diff changeset
  3224
!
Claus Gittinger <cg@exept.de>
parents: 4799
diff changeset
  3225
5606
dfa005ef9e11 Define #encodeWith:on:
Stefan Vogel <sv@exept.de>
parents: 5597
diff changeset
  3226
encodeOn:anEncoder with:aParameter
dfa005ef9e11 Define #encodeWith:on:
Stefan Vogel <sv@exept.de>
parents: 5597
diff changeset
  3227
    "double-dispatch onto an ObjectEncoder.
dfa005ef9e11 Define #encodeWith:on:
Stefan Vogel <sv@exept.de>
parents: 5597
diff changeset
  3228
     Subclasses redefine this"
dfa005ef9e11 Define #encodeWith:on:
Stefan Vogel <sv@exept.de>
parents: 5597
diff changeset
  3229
dfa005ef9e11 Define #encodeWith:on:
Stefan Vogel <sv@exept.de>
parents: 5597
diff changeset
  3230
    anEncoder encodeObject:self with:aParameter
dfa005ef9e11 Define #encodeWith:on:
Stefan Vogel <sv@exept.de>
parents: 5597
diff changeset
  3231
dfa005ef9e11 Define #encodeWith:on:
Stefan Vogel <sv@exept.de>
parents: 5597
diff changeset
  3232
dfa005ef9e11 Define #encodeWith:on:
Stefan Vogel <sv@exept.de>
parents: 5597
diff changeset
  3233
!
dfa005ef9e11 Define #encodeWith:on:
Stefan Vogel <sv@exept.de>
parents: 5597
diff changeset
  3234
4808
Claus Gittinger <cg@exept.de>
parents: 4799
diff changeset
  3235
fromLiteralArrayEncoding:aSpecArray
Claus Gittinger <cg@exept.de>
parents: 4799
diff changeset
  3236
    "read my attributes from aSpecArray
Claus Gittinger <cg@exept.de>
parents: 4799
diff changeset
  3237
    "
Claus Gittinger <cg@exept.de>
parents: 4799
diff changeset
  3238
    |sel val
Claus Gittinger <cg@exept.de>
parents: 4799
diff changeset
  3239
     stop   "{ Class:SmallInteger }" |
Claus Gittinger <cg@exept.de>
parents: 4799
diff changeset
  3240
Claus Gittinger <cg@exept.de>
parents: 4799
diff changeset
  3241
    stop := aSpecArray size.
Claus Gittinger <cg@exept.de>
parents: 4799
diff changeset
  3242
Claus Gittinger <cg@exept.de>
parents: 4799
diff changeset
  3243
    2 to:stop by:2 do:[:i|
Claus Gittinger <cg@exept.de>
parents: 4799
diff changeset
  3244
        sel := aSpecArray at:i.
Claus Gittinger <cg@exept.de>
parents: 4799
diff changeset
  3245
        val := aSpecArray at:i + 1.
Claus Gittinger <cg@exept.de>
parents: 4799
diff changeset
  3246
Claus Gittinger <cg@exept.de>
parents: 4799
diff changeset
  3247
        (self respondsTo:sel) ifTrue:[
Claus Gittinger <cg@exept.de>
parents: 4799
diff changeset
  3248
            self perform:sel with:(val decodeAsLiteralArray)
Claus Gittinger <cg@exept.de>
parents: 4799
diff changeset
  3249
        ] ifFalse:[
Claus Gittinger <cg@exept.de>
parents: 4799
diff changeset
  3250
            Transcript show:self class name; show:': unhandled literalArrayEncoding attribute: '.
Claus Gittinger <cg@exept.de>
parents: 4799
diff changeset
  3251
            Transcript showCR:sel.
Claus Gittinger <cg@exept.de>
parents: 4799
diff changeset
  3252
        ]
Claus Gittinger <cg@exept.de>
parents: 4799
diff changeset
  3253
    ]
Claus Gittinger <cg@exept.de>
parents: 4799
diff changeset
  3254
Claus Gittinger <cg@exept.de>
parents: 4799
diff changeset
  3255
Claus Gittinger <cg@exept.de>
parents: 4799
diff changeset
  3256
!
Claus Gittinger <cg@exept.de>
parents: 4799
diff changeset
  3257
Claus Gittinger <cg@exept.de>
parents: 4799
diff changeset
  3258
literalArrayEncoding
Claus Gittinger <cg@exept.de>
parents: 4799
diff changeset
  3259
    "generate a literalArrayEncoding array for myself.
Claus Gittinger <cg@exept.de>
parents: 4799
diff changeset
  3260
     This uses #literalArrayEncodingSlotOrder which defines the slots and
Claus Gittinger <cg@exept.de>
parents: 4799
diff changeset
  3261
     order and #skippedInLiteralEncoding which defines slots to skip.
Claus Gittinger <cg@exept.de>
parents: 4799
diff changeset
  3262
     For most subclasses, there is no need to redefine those."
Claus Gittinger <cg@exept.de>
parents: 4799
diff changeset
  3263
Claus Gittinger <cg@exept.de>
parents: 4799
diff changeset
  3264
    |names encoding cls skipped|
Claus Gittinger <cg@exept.de>
parents: 4799
diff changeset
  3265
Claus Gittinger <cg@exept.de>
parents: 4799
diff changeset
  3266
    self isLiteral ifTrue:[
Claus Gittinger <cg@exept.de>
parents: 4799
diff changeset
  3267
        ^ self
Claus Gittinger <cg@exept.de>
parents: 4799
diff changeset
  3268
    ].
Claus Gittinger <cg@exept.de>
parents: 4799
diff changeset
  3269
Claus Gittinger <cg@exept.de>
parents: 4799
diff changeset
  3270
    skipped  := self skippedInLiteralEncoding.
Claus Gittinger <cg@exept.de>
parents: 4799
diff changeset
  3271
    cls      := self class.
Claus Gittinger <cg@exept.de>
parents: 4799
diff changeset
  3272
    names    := cls allInstVarNames.
Claus Gittinger <cg@exept.de>
parents: 4799
diff changeset
  3273
    encoding := OrderedCollection with:(cls name).
Claus Gittinger <cg@exept.de>
parents: 4799
diff changeset
  3274
Claus Gittinger <cg@exept.de>
parents: 4799
diff changeset
  3275
    (self literalArrayEncodingSlotOrder) do:[:instSlot |
Claus Gittinger <cg@exept.de>
parents: 4799
diff changeset
  3276
        |value nm|
Claus Gittinger <cg@exept.de>
parents: 4799
diff changeset
  3277
Claus Gittinger <cg@exept.de>
parents: 4799
diff changeset
  3278
        nm := names at:instSlot.
Claus Gittinger <cg@exept.de>
parents: 4799
diff changeset
  3279
Claus Gittinger <cg@exept.de>
parents: 4799
diff changeset
  3280
        (skipped includes:nm) ifFalse:[
Claus Gittinger <cg@exept.de>
parents: 4799
diff changeset
  3281
            (value := self instVarAt:instSlot) notNil ifTrue:[
Claus Gittinger <cg@exept.de>
parents: 4799
diff changeset
  3282
                encoding add:(nm , ':') asSymbol.
Claus Gittinger <cg@exept.de>
parents: 4799
diff changeset
  3283
                encoding add:value literalArrayEncoding
Claus Gittinger <cg@exept.de>
parents: 4799
diff changeset
  3284
            ]
Claus Gittinger <cg@exept.de>
parents: 4799
diff changeset
  3285
        ]
Claus Gittinger <cg@exept.de>
parents: 4799
diff changeset
  3286
    ].
Claus Gittinger <cg@exept.de>
parents: 4799
diff changeset
  3287
    ^ encoding asArray
Claus Gittinger <cg@exept.de>
parents: 4799
diff changeset
  3288
Claus Gittinger <cg@exept.de>
parents: 4799
diff changeset
  3289
Claus Gittinger <cg@exept.de>
parents: 4799
diff changeset
  3290
!
Claus Gittinger <cg@exept.de>
parents: 4799
diff changeset
  3291
Claus Gittinger <cg@exept.de>
parents: 4799
diff changeset
  3292
literalArrayEncodingSlotOrder
Claus Gittinger <cg@exept.de>
parents: 4799
diff changeset
  3293
    "define the order in which inst-slots are saved when generating
Claus Gittinger <cg@exept.de>
parents: 4799
diff changeset
  3294
     a literalArrayEncoding
Claus Gittinger <cg@exept.de>
parents: 4799
diff changeset
  3295
    "
Claus Gittinger <cg@exept.de>
parents: 4799
diff changeset
  3296
    ^ 1 to:self class instSize
Claus Gittinger <cg@exept.de>
parents: 4799
diff changeset
  3297
Claus Gittinger <cg@exept.de>
parents: 4799
diff changeset
  3298
!
Claus Gittinger <cg@exept.de>
parents: 4799
diff changeset
  3299
Claus Gittinger <cg@exept.de>
parents: 4799
diff changeset
  3300
skippedInLiteralEncoding
Claus Gittinger <cg@exept.de>
parents: 4799
diff changeset
  3301
    "return a Collection with it's elements are slots for skipping
Claus Gittinger <cg@exept.de>
parents: 4799
diff changeset
  3302
    "
Claus Gittinger <cg@exept.de>
parents: 4799
diff changeset
  3303
    ^ #()
Claus Gittinger <cg@exept.de>
parents: 4799
diff changeset
  3304
Claus Gittinger <cg@exept.de>
parents: 4799
diff changeset
  3305
! !
Claus Gittinger <cg@exept.de>
parents: 4799
diff changeset
  3306
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3307
!Object methodsFor:'error handling'!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3308
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3309
appropriateDebugger:aSelector
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3310
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3311
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3312
    "return an appropriate debugger to use.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3313
     If there is already a debugger active on the stack, and it is
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3314
     the DebugView, return MiniDebugger (as a last chance) otherwise abort."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3315
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3316
    |context|
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3317
1678
1c0fc4e322d0 Change #appropriateDebugger: to call Minidebugger when being called by
Stefan Vogel <sv@exept.de>
parents: 1674
diff changeset
  3318
    "DebugView cannot run without system processes"
1c0fc4e322d0 Change #appropriateDebugger: to call Minidebugger when being called by
Stefan Vogel <sv@exept.de>
parents: 1674
diff changeset
  3319
1685
5f867e93af8e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1684
diff changeset
  3320
    (Processor isNil 
4208
fb27208e08f1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4103
diff changeset
  3321
    or:[Processor activeProcessIsSystemProcess
fb27208e08f1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4103
diff changeset
  3322
    or:[Smalltalk isInitialized not]]) ifTrue:[
fb27208e08f1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4103
diff changeset
  3323
        ^ MiniDebugger
1678
1c0fc4e322d0 Change #appropriateDebugger: to call Minidebugger when being called by
Stefan Vogel <sv@exept.de>
parents: 1674
diff changeset
  3324
    ].
5180
8b625cdc8cef *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5149
diff changeset
  3325
    (Screen isNil or:[Screen default isNil]) ifTrue:[
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  3326
        Debugger isNil ifTrue:[^ Debugger].
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  3327
        ^ MiniDebugger
5180
8b625cdc8cef *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5149
diff changeset
  3328
    ].
1678
1c0fc4e322d0 Change #appropriateDebugger: to call Minidebugger when being called by
Stefan Vogel <sv@exept.de>
parents: 1674
diff changeset
  3329
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3330
    context := thisContext.
2893
8ba406da6b22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2851
diff changeset
  3331
    context := context findNextContextWithSelector:aSelector or:nil or:nil.
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3332
    [context notNil] whileTrue:[
4208
fb27208e08f1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4103
diff changeset
  3333
        ((context receiver class == Debugger) 
fb27208e08f1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4103
diff changeset
  3334
         and:[context selector == aSelector]) ifTrue:[
fb27208e08f1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4103
diff changeset
  3335
            "we are already in some Debugger"
fb27208e08f1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4103
diff changeset
  3336
            (Debugger == MiniDebugger) ifTrue:[
fb27208e08f1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4103
diff changeset
  3337
                "we are already in the MiniDebugger"
fb27208e08f1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4103
diff changeset
  3338
                ErrorRecursion ifFalse:[
fb27208e08f1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4103
diff changeset
  3339
                    Smalltalk fatalAbort:'recursive error ...'
fb27208e08f1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4103
diff changeset
  3340
                ]
fb27208e08f1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4103
diff changeset
  3341
            ].
fb27208e08f1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4103
diff changeset
  3342
            MiniDebugger isNil ifTrue:[
fb27208e08f1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4103
diff changeset
  3343
                Smalltalk fatalAbort:'no debugger'
fb27208e08f1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4103
diff changeset
  3344
            ].
fb27208e08f1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4103
diff changeset
  3345
fb27208e08f1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4103
diff changeset
  3346
            "ok, an error occured while in the graphical debugger;
fb27208e08f1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4103
diff changeset
  3347
             lets try MiniDebugger"
fb27208e08f1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4103
diff changeset
  3348
            ^ MiniDebugger
fb27208e08f1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4103
diff changeset
  3349
        ].
fb27208e08f1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4103
diff changeset
  3350
        context := context findNextContextWithSelector:aSelector or:nil or:nil.
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  3351
    ].
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3352
    "not within Debugger - no problem"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3353
    ^ Debugger
1678
1c0fc4e322d0 Change #appropriateDebugger: to call Minidebugger when being called by
Stefan Vogel <sv@exept.de>
parents: 1674
diff changeset
  3354
3063
d4bc0c596b98 dependents always returns a collection.
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
  3355
    "Modified: / 23.9.1996 / 12:14:52 / stefan"
4208
fb27208e08f1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4103
diff changeset
  3356
    "Modified: / 19.5.1999 / 18:05:00 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3357
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3358
2229
a9881102b243 new feature: cannotSendMessage:to:
Claus Gittinger <cg@exept.de>
parents: 2227
diff changeset
  3359
cannotSendMessage:aMessage to:someReceiver
a9881102b243 new feature: cannotSendMessage:to:
Claus Gittinger <cg@exept.de>
parents: 2227
diff changeset
  3360
    "this message is sent by the runtime system (VM),
a9881102b243 new feature: cannotSendMessage:to:
Claus Gittinger <cg@exept.de>
parents: 2227
diff changeset
  3361
     when a message is sent to some object, whose class is not
2231
88ffbbaf1986 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2229
diff changeset
  3362
     a valid behavior (see documentation in Behavior)."
2229
a9881102b243 new feature: cannotSendMessage:to:
Claus Gittinger <cg@exept.de>
parents: 2227
diff changeset
  3363
a9881102b243 new feature: cannotSendMessage:to:
Claus Gittinger <cg@exept.de>
parents: 2227
diff changeset
  3364
    ^ InternalErrorSignal
4469
8719f53c8151 dont raise nonProceedable InternalErrorSignal proceedable.
Claus Gittinger <cg@exept.de>
parents: 4452
diff changeset
  3365
          raiseWith:someReceiver
8719f53c8151 dont raise nonProceedable InternalErrorSignal proceedable.
Claus Gittinger <cg@exept.de>
parents: 4452
diff changeset
  3366
          errorString:('bad class in send of #' , aMessage selector)
2231
88ffbbaf1986 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2229
diff changeset
  3367
88ffbbaf1986 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2229
diff changeset
  3368
    "Modified: 23.1.1997 / 00:05:39 / cg"
2229
a9881102b243 new feature: cannotSendMessage:to:
Claus Gittinger <cg@exept.de>
parents: 2227
diff changeset
  3369
!
a9881102b243 new feature: cannotSendMessage:to:
Claus Gittinger <cg@exept.de>
parents: 2227
diff changeset
  3370
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3371
doesNotUnderstand:aMessage
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3372
    "this message is sent by the runtime system (VM) when
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3373
     a message is not understood by some object (i.e. there
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3374
     is no method for that selector). The original message has
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3375
     been packed into aMessage (i.e. the receiver, selector and
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3376
     any arguments) and the original receiver is then sent the
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3377
     #doesNotUnderstand: message.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3378
     Here, we raise another signal which usually enters the debugger.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3379
     You can of course redefine #doesNotUnderstand: in your classes
1327
5dd6b52d8325 comments
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  3380
     to implement message delegation, 
5dd6b52d8325 comments
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  3381
     or handle the MessageNotUnderstoodSignal gracefully."
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3382
4558
94044dccefab checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4537
diff changeset
  3383
    <context: #return>
94044dccefab checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4537
diff changeset
  3384
4287
cb4ae74a5c11 better errorString when selector is not a symbol
Claus Gittinger <cg@exept.de>
parents: 4267
diff changeset
  3385
    |sel selStr errorString cls sender|
cb4ae74a5c11 better errorString when selector is not a symbol
Claus Gittinger <cg@exept.de>
parents: 4267
diff changeset
  3386
cb4ae74a5c11 better errorString when selector is not a symbol
Claus Gittinger <cg@exept.de>
parents: 4267
diff changeset
  3387
    sel := aMessage selector.
cb4ae74a5c11 better errorString when selector is not a symbol
Claus Gittinger <cg@exept.de>
parents: 4267
diff changeset
  3388
    selStr := sel printString.
2818
58125948706b care for bad selector in #doesNotUnderstand:
Claus Gittinger <cg@exept.de>
parents: 2774
diff changeset
  3389
58125948706b care for bad selector in #doesNotUnderstand:
Claus Gittinger <cg@exept.de>
parents: 2774
diff changeset
  3390
    "/ Although sel should always be a symbol,
58125948706b care for bad selector in #doesNotUnderstand:
Claus Gittinger <cg@exept.de>
parents: 2774
diff changeset
  3391
    "/ always use printStrings in the code below.
58125948706b care for bad selector in #doesNotUnderstand:
Claus Gittinger <cg@exept.de>
parents: 2774
diff changeset
  3392
    "/ Non-symbol selector may happen when things go mad in a primitive, 
58125948706b care for bad selector in #doesNotUnderstand:
Claus Gittinger <cg@exept.de>
parents: 2774
diff changeset
  3393
    "/ or a method has been called by valueWithReceiver: with a wrong arg.
58125948706b care for bad selector in #doesNotUnderstand:
Claus Gittinger <cg@exept.de>
parents: 2774
diff changeset
  3394
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3395
    "/ handle the case of an error during early startup
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3396
    "/ (output streams not yet initialized)
2818
58125948706b care for bad selector in #doesNotUnderstand:
Claus Gittinger <cg@exept.de>
parents: 2774
diff changeset
  3397
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3398
    Stdout isNil ifTrue:[
4287
cb4ae74a5c11 better errorString when selector is not a symbol
Claus Gittinger <cg@exept.de>
parents: 4267
diff changeset
  3399
        Smalltalk fatalAbort:'error during init: ' , selStr , ' not understood'.
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3400
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3401
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3402
    "/
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3403
    "/ extract the class that should have implemented the message.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3404
    "/ (in case of a super-send, this is not the receivers class)
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3405
    "/
4558
94044dccefab checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4537
diff changeset
  3406
    cls := thisContext sender searchClass.
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3407
    cls isNil ifTrue:[
4287
cb4ae74a5c11 better errorString when selector is not a symbol
Claus Gittinger <cg@exept.de>
parents: 4267
diff changeset
  3408
        "it was NOT a super or directed send ..."
cb4ae74a5c11 better errorString when selector is not a symbol
Claus Gittinger <cg@exept.de>
parents: 4267
diff changeset
  3409
        cls := self class
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3410
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3411
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3412
    cls notNil ifTrue:[
4287
cb4ae74a5c11 better errorString when selector is not a symbol
Claus Gittinger <cg@exept.de>
parents: 4267
diff changeset
  3413
        "/
cb4ae74a5c11 better errorString when selector is not a symbol
Claus Gittinger <cg@exept.de>
parents: 4267
diff changeset
  3414
        "/ displayString is better than 'cls name',
cb4ae74a5c11 better errorString when selector is not a symbol
Claus Gittinger <cg@exept.de>
parents: 4267
diff changeset
  3415
        "/ since it appends (obsolete) for outdated classes.
cb4ae74a5c11 better errorString when selector is not a symbol
Claus Gittinger <cg@exept.de>
parents: 4267
diff changeset
  3416
        "/ (this happens if you send messages to old instances
cb4ae74a5c11 better errorString when selector is not a symbol
Claus Gittinger <cg@exept.de>
parents: 4267
diff changeset
  3417
        "/  after changing a classes definition)
cb4ae74a5c11 better errorString when selector is not a symbol
Claus Gittinger <cg@exept.de>
parents: 4267
diff changeset
  3418
        "/
cb4ae74a5c11 better errorString when selector is not a symbol
Claus Gittinger <cg@exept.de>
parents: 4267
diff changeset
  3419
        errorString := cls displayString.
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3420
    ] ifFalse:[    
4287
cb4ae74a5c11 better errorString when selector is not a symbol
Claus Gittinger <cg@exept.de>
parents: 4267
diff changeset
  3421
        errorString := '(** nil-class **)'
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3422
    ].
4287
cb4ae74a5c11 better errorString when selector is not a symbol
Claus Gittinger <cg@exept.de>
parents: 4267
diff changeset
  3423
    sel class ~~ Symbol ifTrue:[
cb4ae74a5c11 better errorString when selector is not a symbol
Claus Gittinger <cg@exept.de>
parents: 4267
diff changeset
  3424
        errorString := errorString , ' nonSymbol selector: ' , selStr , ' not understood'.
cb4ae74a5c11 better errorString when selector is not a symbol
Claus Gittinger <cg@exept.de>
parents: 4267
diff changeset
  3425
    ] ifFalse:[
cb4ae74a5c11 better errorString when selector is not a symbol
Claus Gittinger <cg@exept.de>
parents: 4267
diff changeset
  3426
        errorString := errorString , ' does not understand: ' , selStr.
cb4ae74a5c11 better errorString when selector is not a symbol
Claus Gittinger <cg@exept.de>
parents: 4267
diff changeset
  3427
    ].
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3428
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3429
    "/
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3430
    "/ this only happens, when YOU play around with my classvars ...
1327
5dd6b52d8325 comments
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  3431
    "/ (or an error occurs during very early startup, when signals are not yet set)
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3432
    "/
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3433
    MessageNotUnderstoodSignal isNil ifTrue:[
4535
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  3434
        ^ MiniDebugger 
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  3435
            enterWithMessage:'oops - MessageNotUnderstoodSignal is gone (nil)'
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  3436
            mayProceed:true.
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3437
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3438
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3439
    "/
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3440
    "/ thats where we end up normally - raise a signal which (if unhandled) opens a debugger
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3441
    "/
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3442
    ^ MessageNotUnderstoodSignal
4287
cb4ae74a5c11 better errorString when selector is not a symbol
Claus Gittinger <cg@exept.de>
parents: 4267
diff changeset
  3443
                raiseRequestWith:aMessage
4535
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  3444
                errorString:errorString
4287
cb4ae74a5c11 better errorString when selector is not a symbol
Claus Gittinger <cg@exept.de>
parents: 4267
diff changeset
  3445
cb4ae74a5c11 better errorString when selector is not a symbol
Claus Gittinger <cg@exept.de>
parents: 4267
diff changeset
  3446
    "Modified: / 9.6.1999 / 17:46:17 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3447
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3448
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3449
elementBoundsError
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3450
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3451
1345
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  3452
    "report an error that badElement is out of bounds 
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  3453
     (i.e. cannot be put into that collection).
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  3454
     The error is reported by raising the ElementOutOfBoundsSignal exception."
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3455
4558
94044dccefab checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4537
diff changeset
  3456
    ^ ElementOutOfBoundsSignal raise
1345
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  3457
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  3458
    "Modified: 8.5.1996 / 09:12:45 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3459
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3460
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3461
elementNotCharacter
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3462
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3463
1345
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  3464
    "report an error that object to be stored is no Character.
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  3465
     (usually when storing into Strings).
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  3466
     The error is reported by raising the ElementOutOfBoundsSignal exception."
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3467
4558
94044dccefab checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4537
diff changeset
  3468
    ^ ElementOutOfBoundsSignal raise
1345
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  3469
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  3470
    "Modified: 8.5.1996 / 09:12:49 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3471
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3472
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3473
elementNotInteger
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3474
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3475
1345
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  3476
    "report an error that object to be stored is not Integer.
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  3477
     (in collections that store integers only).
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  3478
     The error is reported by raising the ElementOutOfBoundsSignal exception."
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3479
4558
94044dccefab checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4537
diff changeset
  3480
    ^ ElementOutOfBoundsSignal raise
1345
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  3481
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  3482
    "Modified: 8.5.1996 / 09:12:51 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3483
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3484
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3485
error
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3486
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3487
4558
94044dccefab checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4537
diff changeset
  3488
    <context: #return>
94044dccefab checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4537
diff changeset
  3489
1345
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  3490
    "report error that an error occured.
4558
94044dccefab checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4537
diff changeset
  3491
     The error is reported by raising the Error exception,
94044dccefab checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4537
diff changeset
  3492
     which is non-proceedable.
94044dccefab checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4537
diff changeset
  3493
     If no handler has been setup, a debugger is entered."
94044dccefab checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4537
diff changeset
  3494
94044dccefab checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4537
diff changeset
  3495
    Error raiseWith:#error:
94044dccefab checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4537
diff changeset
  3496
94044dccefab checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4537
diff changeset
  3497
    "
94044dccefab checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4537
diff changeset
  3498
     nil error
4529
b594b60be7c4 New method #error:mayProceed
Stefan Vogel <sv@exept.de>
parents: 4522
diff changeset
  3499
    "
4452
3d050f505a0a Raise proceedable signals proceedable.
Stefan Vogel <sv@exept.de>
parents: 4392
diff changeset
  3500
3d050f505a0a Raise proceedable signals proceedable.
Stefan Vogel <sv@exept.de>
parents: 4392
diff changeset
  3501
    "Modified: / 8.5.1996 / 09:13:01 / cg"
4499
251d4c698581 Send #halt resp. #error as signal parameter in these methods.
Stefan Vogel <sv@exept.de>
parents: 4469
diff changeset
  3502
    "Modified: / 2.8.1999 / 17:00:19 / stefan"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3503
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3504
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3505
error:aString
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3506
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3507
4558
94044dccefab checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4537
diff changeset
  3508
    <context: #return>
94044dccefab checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4537
diff changeset
  3509
94044dccefab checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4537
diff changeset
  3510
    "Raise an error with error message aString.
94044dccefab checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4537
diff changeset
  3511
     The error is reported by raising the Error exception,
94044dccefab checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4537
diff changeset
  3512
     which is non-proceedable.
94044dccefab checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4537
diff changeset
  3513
     If no handler has been setup, a debugger is entered."
94044dccefab checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4537
diff changeset
  3514
94044dccefab checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4537
diff changeset
  3515
    Error raiseWith:#error: errorString:aString 
4529
b594b60be7c4 New method #error:mayProceed
Stefan Vogel <sv@exept.de>
parents: 4522
diff changeset
  3516
b594b60be7c4 New method #error:mayProceed
Stefan Vogel <sv@exept.de>
parents: 4522
diff changeset
  3517
    "
b594b60be7c4 New method #error:mayProceed
Stefan Vogel <sv@exept.de>
parents: 4522
diff changeset
  3518
      nil error:' bad bad bad'
b594b60be7c4 New method #error:mayProceed
Stefan Vogel <sv@exept.de>
parents: 4522
diff changeset
  3519
    "
1345
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  3520
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  3521
    "Modified: 8.5.1996 / 09:13:04 / cg"
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  3522
!
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  3523
4529
b594b60be7c4 New method #error:mayProceed
Stefan Vogel <sv@exept.de>
parents: 4522
diff changeset
  3524
error:aString mayProceed:mayProceed
b594b60be7c4 New method #error:mayProceed
Stefan Vogel <sv@exept.de>
parents: 4522
diff changeset
  3525
    "{ Pragma: +optSpace }"
b594b60be7c4 New method #error:mayProceed
Stefan Vogel <sv@exept.de>
parents: 4522
diff changeset
  3526
1345
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  3527
    "enter debugger with error-message aString.
4558
94044dccefab checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4537
diff changeset
  3528
     The error is reported by raising either the 
94044dccefab checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4537
diff changeset
  3529
     non-proceedable Error exception,
94044dccefab checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4537
diff changeset
  3530
     or the ProceedableError exception."
1345
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  3531
4529
b594b60be7c4 New method #error:mayProceed
Stefan Vogel <sv@exept.de>
parents: 4522
diff changeset
  3532
    mayProceed ifTrue:[
4558
94044dccefab checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4537
diff changeset
  3533
        ^ ProceedableError raiseRequestWith:#error: errorString:aString 
4529
b594b60be7c4 New method #error:mayProceed
Stefan Vogel <sv@exept.de>
parents: 4522
diff changeset
  3534
    ].
b594b60be7c4 New method #error:mayProceed
Stefan Vogel <sv@exept.de>
parents: 4522
diff changeset
  3535
4558
94044dccefab checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4537
diff changeset
  3536
    Error raiseWith:#error: errorString:aString 
4529
b594b60be7c4 New method #error:mayProceed
Stefan Vogel <sv@exept.de>
parents: 4522
diff changeset
  3537
b594b60be7c4 New method #error:mayProceed
Stefan Vogel <sv@exept.de>
parents: 4522
diff changeset
  3538
    "Modified: 8.5.1996 / 09:13:04 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3539
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3540
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3541
errorKeyNotFound:aKey
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3542
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3543
1345
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  3544
    "report an error that a key was not found in a collection.
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  3545
     The error is reported by raising the KeyNotFoundSignal exception."
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3546
4558
94044dccefab checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4537
diff changeset
  3547
    ^ KeyNotFoundSignal raiseRequestWith:aKey
94044dccefab checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4537
diff changeset
  3548
94044dccefab checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4537
diff changeset
  3549
    "
94044dccefab checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4537
diff changeset
  3550
     #(1 2) at:3
94044dccefab checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4537
diff changeset
  3551
    "
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3552
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3553
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3554
errorNotFound
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3555
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3556
1345
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  3557
    "report an error that no element was found in a collection.
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  3558
     The error is reported by raising the NotFoundSignal exception."
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3559
4558
94044dccefab checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4537
diff changeset
  3560
    ^ NotFoundSignal raiseRequestWith:nil
4452
3d050f505a0a Raise proceedable signals proceedable.
Stefan Vogel <sv@exept.de>
parents: 4392
diff changeset
  3561
3d050f505a0a Raise proceedable signals proceedable.
Stefan Vogel <sv@exept.de>
parents: 4392
diff changeset
  3562
    "Modified: / 8.5.1996 / 09:13:11 / cg"
3d050f505a0a Raise proceedable signals proceedable.
Stefan Vogel <sv@exept.de>
parents: 4392
diff changeset
  3563
    "Modified: / 26.7.1999 / 10:51:50 / stefan"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3564
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3565
3622
5b1e8a260a64 added instance>>errorSignal
Claus Gittinger <cg@exept.de>
parents: 3598
diff changeset
  3566
errorSignal
5b1e8a260a64 added instance>>errorSignal
Claus Gittinger <cg@exept.de>
parents: 3598
diff changeset
  3567
    ^ self class errorSignal
5b1e8a260a64 added instance>>errorSignal
Claus Gittinger <cg@exept.de>
parents: 3598
diff changeset
  3568
5b1e8a260a64 added instance>>errorSignal
Claus Gittinger <cg@exept.de>
parents: 3598
diff changeset
  3569
    "Created: / 19.6.1998 / 02:32:32 / cg"
5b1e8a260a64 added instance>>errorSignal
Claus Gittinger <cg@exept.de>
parents: 3598
diff changeset
  3570
!
5b1e8a260a64 added instance>>errorSignal
Claus Gittinger <cg@exept.de>
parents: 3598
diff changeset
  3571
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3572
halt
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3573
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3574
1345
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  3575
    "enter debugger with halt-message.
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  3576
     The error is reported by raising the HaltSignal exception."
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3577
4558
94044dccefab checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4537
diff changeset
  3578
    ^ HaltSignal raiseRequestWith:#halt
4452
3d050f505a0a Raise proceedable signals proceedable.
Stefan Vogel <sv@exept.de>
parents: 4392
diff changeset
  3579
3d050f505a0a Raise proceedable signals proceedable.
Stefan Vogel <sv@exept.de>
parents: 4392
diff changeset
  3580
    "Modified: / 8.5.1996 / 09:12:38 / cg"
4499
251d4c698581 Send #halt resp. #error as signal parameter in these methods.
Stefan Vogel <sv@exept.de>
parents: 4469
diff changeset
  3581
    "Modified: / 2.8.1999 / 17:00:29 / stefan"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3582
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3583
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3584
halt:aString
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3585
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3586
1345
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  3587
    "enter debugger with halt-message.
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  3588
     The error is reported by raising the HaltSignal exception."
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3589
4558
94044dccefab checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4537
diff changeset
  3590
    ^ HaltSignal raiseRequestWith:#halt: errorString:aString
1345
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  3591
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  3592
    "Modified: 8.5.1996 / 09:13:23 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3593
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3594
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3595
implementedBySubclass
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3596
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3597
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3598
    "this is sent by ST/V code - its the same as #subclassResponsibility"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3599
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3600
    ^ self subclassResponsibility
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3601
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3602
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3603
indexNotInteger
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3604
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3605
1345
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  3606
    "report an error that index is not an Integer.
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  3607
     (when accessing collections indexed by an integer key).
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  3608
     The error is reported by raising the NonIntegerIndexSignal exception."
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3609
4558
94044dccefab checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4537
diff changeset
  3610
    ^ NonIntegerIndexSignal raiseRequestWith:nil
4452
3d050f505a0a Raise proceedable signals proceedable.
Stefan Vogel <sv@exept.de>
parents: 4392
diff changeset
  3611
3d050f505a0a Raise proceedable signals proceedable.
Stefan Vogel <sv@exept.de>
parents: 4392
diff changeset
  3612
    "Modified: / 8.5.1996 / 09:13:37 / cg"
3d050f505a0a Raise proceedable signals proceedable.
Stefan Vogel <sv@exept.de>
parents: 4392
diff changeset
  3613
    "Modified: / 26.7.1999 / 10:57:43 / stefan"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3614
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3615
3450
8e2ebfb882bd added indexNotInteger: (i.e. with argument)
Claus Gittinger <cg@exept.de>
parents: 3437
diff changeset
  3616
indexNotInteger:anIndex
8e2ebfb882bd added indexNotInteger: (i.e. with argument)
Claus Gittinger <cg@exept.de>
parents: 3437
diff changeset
  3617
    "{ Pragma: +optSpace }"
8e2ebfb882bd added indexNotInteger: (i.e. with argument)
Claus Gittinger <cg@exept.de>
parents: 3437
diff changeset
  3618
8e2ebfb882bd added indexNotInteger: (i.e. with argument)
Claus Gittinger <cg@exept.de>
parents: 3437
diff changeset
  3619
    "report an error that index is not an Integer.
8e2ebfb882bd added indexNotInteger: (i.e. with argument)
Claus Gittinger <cg@exept.de>
parents: 3437
diff changeset
  3620
     (when accessing collections indexed by an integer key).
8e2ebfb882bd added indexNotInteger: (i.e. with argument)
Claus Gittinger <cg@exept.de>
parents: 3437
diff changeset
  3621
     The error is reported by raising the NonIntegerIndexSignal exception."
8e2ebfb882bd added indexNotInteger: (i.e. with argument)
Claus Gittinger <cg@exept.de>
parents: 3437
diff changeset
  3622
4558
94044dccefab checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4537
diff changeset
  3623
    ^ NonIntegerIndexSignal raiseRequestWith:anIndex 
3450
8e2ebfb882bd added indexNotInteger: (i.e. with argument)
Claus Gittinger <cg@exept.de>
parents: 3437
diff changeset
  3624
8e2ebfb882bd added indexNotInteger: (i.e. with argument)
Claus Gittinger <cg@exept.de>
parents: 3437
diff changeset
  3625
    "Created: / 16.5.1998 / 19:39:41 / cg"
8e2ebfb882bd added indexNotInteger: (i.e. with argument)
Claus Gittinger <cg@exept.de>
parents: 3437
diff changeset
  3626
!
8e2ebfb882bd added indexNotInteger: (i.e. with argument)
Claus Gittinger <cg@exept.de>
parents: 3437
diff changeset
  3627
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3628
integerCheckError
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3629
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3630
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3631
    "generated when a variable declared with an integer type gets a bad
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3632
     value assigned"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3633
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3634
    ^ self error:'bad assign of ' , self printString , 
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  3635
                  ' (' , self class name , ') to integer-typed variable'
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  3636
!
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  3637
2829
909f31cc9b0b must provide #invalidCodeObject
Claus Gittinger <cg@exept.de>
parents: 2819
diff changeset
  3638
invalidCodeObject
909f31cc9b0b must provide #invalidCodeObject
Claus Gittinger <cg@exept.de>
parents: 2819
diff changeset
  3639
    "{ Pragma: +optSpace }"
909f31cc9b0b must provide #invalidCodeObject
Claus Gittinger <cg@exept.de>
parents: 2819
diff changeset
  3640
909f31cc9b0b must provide #invalidCodeObject
Claus Gittinger <cg@exept.de>
parents: 2819
diff changeset
  3641
    self error:'not an executable code object'
909f31cc9b0b must provide #invalidCodeObject
Claus Gittinger <cg@exept.de>
parents: 2819
diff changeset
  3642
909f31cc9b0b must provide #invalidCodeObject
Claus Gittinger <cg@exept.de>
parents: 2819
diff changeset
  3643
    "Created: 1.8.1997 / 00:16:44 / cg"
909f31cc9b0b must provide #invalidCodeObject
Claus Gittinger <cg@exept.de>
parents: 2819
diff changeset
  3644
!
909f31cc9b0b must provide #invalidCodeObject
Claus Gittinger <cg@exept.de>
parents: 2819
diff changeset
  3645
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3646
invalidMessage 
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3647
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3648
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3649
    "this is sent by ST/V code - its the same as #shouldNotImplement"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3650
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3651
    ^ self shouldNotImplement
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3652
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3653
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3654
mustBeRectangle
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3655
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3656
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3657
    "report an argument-not-rectangle-error"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3658
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3659
    ^ self error:'argument must be a Rectangle'
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3660
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3661
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3662
mustBeString
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3663
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3664
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3665
    "report an argument-not-string-error"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3666
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3667
    ^ self error:'argument must be a String'
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3668
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3669
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3670
notIndexed
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3671
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3672
4558
94044dccefab checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4537
diff changeset
  3673
    <context: #return>
94044dccefab checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4537
diff changeset
  3674
1611
f8c9a3ab9929 notIndexedError now uses SubscriptBoundsErrorSignal
Claus Gittinger <cg@exept.de>
parents: 1585
diff changeset
  3675
    "report an error that receiver has no indexed instance variables.
f8c9a3ab9929 notIndexedError now uses SubscriptBoundsErrorSignal
Claus Gittinger <cg@exept.de>
parents: 1585
diff changeset
  3676
     The error is reported by raising the SubscriptOutOfBoundsSignal exception."
f8c9a3ab9929 notIndexedError now uses SubscriptBoundsErrorSignal
Claus Gittinger <cg@exept.de>
parents: 1585
diff changeset
  3677
f8c9a3ab9929 notIndexedError now uses SubscriptBoundsErrorSignal
Claus Gittinger <cg@exept.de>
parents: 1585
diff changeset
  3678
    ^ SubscriptOutOfBoundsSignal 
4558
94044dccefab checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4537
diff changeset
  3679
        raiseErrorString:'receiver has no indexed variables'
1611
f8c9a3ab9929 notIndexedError now uses SubscriptBoundsErrorSignal
Claus Gittinger <cg@exept.de>
parents: 1585
diff changeset
  3680
f8c9a3ab9929 notIndexedError now uses SubscriptBoundsErrorSignal
Claus Gittinger <cg@exept.de>
parents: 1585
diff changeset
  3681
    "Modified: 26.7.1996 / 16:43:13 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3682
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3683
4535
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  3684
openDebuggerOnException:ex
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  3685
    "{ Pragma: +optSpace }"
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  3686
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  3687
    "enter the debugger on some unhandled exception"
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  3688
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  3689
    |msgString debugger|
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  3690
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  3691
    msgString := ex errorString.
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  3692
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  3693
    "
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  3694
     if there is no debugger,
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  3695
     ask for ignore or exit. Exit will terminate the applciation.
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  3696
     ignore will raise an abortSignal.
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  3697
    "
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  3698
    Debugger isNil ifTrue:[
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  3699
        msgString := 'error: ' , msgString.
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  3700
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  3701
        Smalltalk isStandAloneApp ifTrue:[
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  3702
            Dialog notNil ifTrue:[
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  3703
                (Dialog 
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  3704
                    confirm:msgString 
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  3705
                    title:(Smalltalk commandName)
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  3706
                    yesLabel:'ignore' noLabel:'exit'
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  3707
                ) ifTrue:[
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  3708
                    ^ AbortSignal raise
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  3709
                ]
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  3710
            ].
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  3711
            msgString errorPrintCR.
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  3712
            OperatingSystem exit:1
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  3713
        ].
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  3714
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  3715
        msgString errorPrintCR.
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  3716
        Smalltalk fatalAbort:'no Debugger defined'
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  3717
    ].
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  3718
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  3719
    "
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  3720
     find an appropriate debugger to use
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  3721
    "
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  3722
    debugger := self appropriateDebugger:(thisContext selector).
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  3723
    debugger isNil ifTrue:[
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  3724
        ^ AbortSignal raise
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  3725
    ].    
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  3726
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  3727
    ^ debugger 
4558
94044dccefab checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4537
diff changeset
  3728
        enter:ex suspendedContext
4535
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  3729
        withMessage:msgString 
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  3730
        mayProceed:(ex mayProceed).
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  3731
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  3732
    "Modified: 24.7.1997 / 10:09:20 / cg"
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  3733
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  3734
!
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  3735
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3736
primitiveFailed
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3737
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3738
1345
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  3739
    "report an error that some primitive code failed.
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  3740
     The error is reported by raising the PrimitiveFailureSignal exception."
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3741
4558
94044dccefab checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4537
diff changeset
  3742
    ^ PrimitiveFailureSignal raiseRequestWith:nil
4452
3d050f505a0a Raise proceedable signals proceedable.
Stefan Vogel <sv@exept.de>
parents: 4392
diff changeset
  3743
3d050f505a0a Raise proceedable signals proceedable.
Stefan Vogel <sv@exept.de>
parents: 4392
diff changeset
  3744
    "Modified: / 8.5.1996 / 09:14:07 / cg"
3d050f505a0a Raise proceedable signals proceedable.
Stefan Vogel <sv@exept.de>
parents: 4392
diff changeset
  3745
    "Modified: / 26.7.1999 / 10:58:08 / stefan"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3746
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3747
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3748
shouldNotImplement
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3749
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3750
1345
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  3751
    "report an error that this message should not be implemented"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3752
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3753
    ^ self error:'method not appropriate for this class'
1345
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  3754
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  3755
    "Modified: 8.5.1996 / 09:09:44 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3756
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3757
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3758
subclassResponsibility
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3759
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3760
1345
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  3761
    "report an error that this message should have been reimplemented in a
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3762
     subclass"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3763
4619
2eb24de5b665 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4603
diff changeset
  3764
    ^ self error:'method must be reimplemented in subclass' mayProceed:true
1345
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  3765
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  3766
    "Modified: 8.5.1996 / 09:09:26 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3767
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3768
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3769
subscriptBoundsError
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3770
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3771
1345
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  3772
    "report an error that some index is out of bounds.
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  3773
     (when accessing indexable collections).
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  3774
     The error is reported by raising the SubscriptOutOfBoundsSignal exception."
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3775
4558
94044dccefab checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4537
diff changeset
  3776
    ^ SubscriptOutOfBoundsSignal raiseRequestWith:nil
4452
3d050f505a0a Raise proceedable signals proceedable.
Stefan Vogel <sv@exept.de>
parents: 4392
diff changeset
  3777
3d050f505a0a Raise proceedable signals proceedable.
Stefan Vogel <sv@exept.de>
parents: 4392
diff changeset
  3778
    "Modified: / 26.7.1996 / 16:45:42 / cg"
3d050f505a0a Raise proceedable signals proceedable.
Stefan Vogel <sv@exept.de>
parents: 4392
diff changeset
  3779
    "Modified: / 26.7.1999 / 10:58:27 / stefan"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3780
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3781
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3782
subscriptBoundsError:anIndex
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3783
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3784
1345
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  3785
    "report an error that anIndex is out of bounds.
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  3786
     (when accessing indexable collections).
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  3787
     The error is reported by raising the SubscriptOutOfBoundsSignal exception."
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3788
1021
b0c7f4a235fb show bad index in subscriptBoundsError
Claus Gittinger <cg@exept.de>
parents: 985
diff changeset
  3789
    ^ SubscriptOutOfBoundsSignal 
4558
94044dccefab checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4537
diff changeset
  3790
        raiseRequestWith:anIndex 
94044dccefab checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4537
diff changeset
  3791
        errorString:('subscript (' , anIndex printString , ') out of bounds')
1021
b0c7f4a235fb show bad index in subscriptBoundsError
Claus Gittinger <cg@exept.de>
parents: 985
diff changeset
  3792
1345
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  3793
    "Modified: 8.5.1996 / 09:14:34 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3794
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3795
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3796
typeCheckError
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3797
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3798
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3799
    "generated when a variable declared with a type hint gets a bad
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3800
     value assigned"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3801
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3802
    ^ self error:'bad assign of ' , self printString ,
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  3803
                  ' (' , self class name , ') to typed variable'
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3804
! !
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3805
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3806
!Object methodsFor:'evaluation'!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3807
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3808
value
1327
5dd6b52d8325 comments
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  3809
    "return the receiver itself.
5dd6b52d8325 comments
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  3810
     This allows every object to be used where blocks or valueHolders
5dd6b52d8325 comments
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  3811
     are typically used, and allows for valueHolders and blocks to be
5dd6b52d8325 comments
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  3812
     used interchangably in some situations.
5dd6b52d8325 comments
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  3813
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3814
     Time will show, if this is a good idea or leads to sloppy programming
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3815
     style ... (the idea was borrowed from the Self language).
1327
5dd6b52d8325 comments
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  3816
5dd6b52d8325 comments
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  3817
     WARNING: dont 'optimize' away ifXXX: blocks 
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  3818
              (i.e. do NOT replace 
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  3819
                        foo ifTrue:[var1] ifFalse:[var2]
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  3820
               by:
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  3821
                        foo ifTrue:var1 ifFalse:var2
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  3822
              )
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  3823
              - the compilers will only generate inline code for the if, 
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  3824
                iff the argument(s) are blocks - otherwise, a true send is
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  3825
                generated.
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  3826
              This 'oprimization' will work semantically correct,
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  3827
              but execute SLOWER instead."
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3828
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3829
    ^ self
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  3830
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  3831
    "
1327
5dd6b52d8325 comments
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  3832
     #(1 2 3 4) indexOf:5 ifAbsent:0     
5dd6b52d8325 comments
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  3833
     #(1 2 3 4) indexOf:5 ifAbsent:[0]     
5dd6b52d8325 comments
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  3834
     1 > 2 ifTrue:['yes'] ifFalse:['no']  
5dd6b52d8325 comments
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  3835
     1 > 2 ifTrue:'yes' ifFalse:'no'       
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3836
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3837
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3838
    "DO NOT DO THIS (its slower)
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3839
     (1 > 4) ifTrue:'oops' ifFalse:'ok'
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3840
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3841
     USE (the compiler optimizes blocks in if/while):
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3842
     (1 > 4) ifTrue:['oops'] ifFalse:['ok']
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3843
    "
1327
5dd6b52d8325 comments
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  3844
5dd6b52d8325 comments
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  3845
    "Modified: 3.5.1996 / 11:57:08 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3846
! !
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3847
3330
5e0af0183446 Add dummy #finalize (as in ST80)
Stefan Vogel <sv@exept.de>
parents: 3317
diff changeset
  3848
!Object methodsFor:'finalization'!
5e0af0183446 Add dummy #finalize (as in ST80)
Stefan Vogel <sv@exept.de>
parents: 3317
diff changeset
  3849
4257
968bc96fd137 added #disposed to avoid errors in Registry.
Claus Gittinger <cg@exept.de>
parents: 4220
diff changeset
  3850
disposed
968bc96fd137 added #disposed to avoid errors in Registry.
Claus Gittinger <cg@exept.de>
parents: 4220
diff changeset
  3851
    "this is invoked for objects which have been registered
968bc96fd137 added #disposed to avoid errors in Registry.
Claus Gittinger <cg@exept.de>
parents: 4220
diff changeset
  3852
     in a Registry, when the original object dies.
968bc96fd137 added #disposed to avoid errors in Registry.
Claus Gittinger <cg@exept.de>
parents: 4220
diff changeset
  3853
     Subclasses may redefine this method"
968bc96fd137 added #disposed to avoid errors in Registry.
Claus Gittinger <cg@exept.de>
parents: 4220
diff changeset
  3854
968bc96fd137 added #disposed to avoid errors in Registry.
Claus Gittinger <cg@exept.de>
parents: 4220
diff changeset
  3855
    ^ self
968bc96fd137 added #disposed to avoid errors in Registry.
Claus Gittinger <cg@exept.de>
parents: 4220
diff changeset
  3856
968bc96fd137 added #disposed to avoid errors in Registry.
Claus Gittinger <cg@exept.de>
parents: 4220
diff changeset
  3857
    "Created: / 4.3.1998 / 10:40:30 / stefan"
968bc96fd137 added #disposed to avoid errors in Registry.
Claus Gittinger <cg@exept.de>
parents: 4220
diff changeset
  3858
!
968bc96fd137 added #disposed to avoid errors in Registry.
Claus Gittinger <cg@exept.de>
parents: 4220
diff changeset
  3859
4574
bcd0132b8d49 going to rename shallowCopyForFinalization to executor
Claus Gittinger <cg@exept.de>
parents: 4558
diff changeset
  3860
executor
bcd0132b8d49 going to rename shallowCopyForFinalization to executor
Claus Gittinger <cg@exept.de>
parents: 4558
diff changeset
  3861
    "for VW & Squeak compatibility.
bcd0132b8d49 going to rename shallowCopyForFinalization to executor
Claus Gittinger <cg@exept.de>
parents: 4558
diff changeset
  3862
     Return the object which does the finalization for me."
bcd0132b8d49 going to rename shallowCopyForFinalization to executor
Claus Gittinger <cg@exept.de>
parents: 4558
diff changeset
  3863
bcd0132b8d49 going to rename shallowCopyForFinalization to executor
Claus Gittinger <cg@exept.de>
parents: 4558
diff changeset
  3864
    ^ self shallowCopyForFinalization
bcd0132b8d49 going to rename shallowCopyForFinalization to executor
Claus Gittinger <cg@exept.de>
parents: 4558
diff changeset
  3865
bcd0132b8d49 going to rename shallowCopyForFinalization to executor
Claus Gittinger <cg@exept.de>
parents: 4558
diff changeset
  3866
    "Created: / 5.8.1999 / 14:06:19 / cg"
bcd0132b8d49 going to rename shallowCopyForFinalization to executor
Claus Gittinger <cg@exept.de>
parents: 4558
diff changeset
  3867
!
bcd0132b8d49 going to rename shallowCopyForFinalization to executor
Claus Gittinger <cg@exept.de>
parents: 4558
diff changeset
  3868
3330
5e0af0183446 Add dummy #finalize (as in ST80)
Stefan Vogel <sv@exept.de>
parents: 3317
diff changeset
  3869
finalize
4257
968bc96fd137 added #disposed to avoid errors in Registry.
Claus Gittinger <cg@exept.de>
parents: 4220
diff changeset
  3870
    "For ST80 compatibility; ST/X uses #disposed when registered
968bc96fd137 added #disposed to avoid errors in Registry.
Claus Gittinger <cg@exept.de>
parents: 4220
diff changeset
  3871
     objects are finalized. This may change."
3330
5e0af0183446 Add dummy #finalize (as in ST80)
Stefan Vogel <sv@exept.de>
parents: 3317
diff changeset
  3872
5e0af0183446 Add dummy #finalize (as in ST80)
Stefan Vogel <sv@exept.de>
parents: 3317
diff changeset
  3873
    ^ self
5e0af0183446 Add dummy #finalize (as in ST80)
Stefan Vogel <sv@exept.de>
parents: 3317
diff changeset
  3874
5e0af0183446 Add dummy #finalize (as in ST80)
Stefan Vogel <sv@exept.de>
parents: 3317
diff changeset
  3875
    "Created: / 4.3.1998 / 10:40:30 / stefan"
5408
5287fd5f6ab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5402
diff changeset
  3876
!
5287fd5f6ab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5402
diff changeset
  3877
5476
d76d23964321 added #reRegisterForFinalization
Claus Gittinger <cg@exept.de>
parents: 5472
diff changeset
  3878
reRegisterForFinalization
d76d23964321 added #reRegisterForFinalization
Claus Gittinger <cg@exept.de>
parents: 5472
diff changeset
  3879
    "re-register mySelf for later finalization.
d76d23964321 added #reRegisterForFinalization
Claus Gittinger <cg@exept.de>
parents: 5472
diff changeset
  3880
     This will create a new executor, which will receive a #disposed message when
d76d23964321 added #reRegisterForFinalization
Claus Gittinger <cg@exept.de>
parents: 5472
diff changeset
  3881
     the receiver is garbage collected."
d76d23964321 added #reRegisterForFinalization
Claus Gittinger <cg@exept.de>
parents: 5472
diff changeset
  3882
d76d23964321 added #reRegisterForFinalization
Claus Gittinger <cg@exept.de>
parents: 5472
diff changeset
  3883
    FinalizationLobby isNil ifTrue:[
d76d23964321 added #reRegisterForFinalization
Claus Gittinger <cg@exept.de>
parents: 5472
diff changeset
  3884
        FinalizationLobby := Registry new.
d76d23964321 added #reRegisterForFinalization
Claus Gittinger <cg@exept.de>
parents: 5472
diff changeset
  3885
    ].
d76d23964321 added #reRegisterForFinalization
Claus Gittinger <cg@exept.de>
parents: 5472
diff changeset
  3886
    FinalizationLobby registerChange:self
d76d23964321 added #reRegisterForFinalization
Claus Gittinger <cg@exept.de>
parents: 5472
diff changeset
  3887
d76d23964321 added #reRegisterForFinalization
Claus Gittinger <cg@exept.de>
parents: 5472
diff changeset
  3888
!
d76d23964321 added #reRegisterForFinalization
Claus Gittinger <cg@exept.de>
parents: 5472
diff changeset
  3889
5408
5287fd5f6ab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5402
diff changeset
  3890
registerForFinalization
5476
d76d23964321 added #reRegisterForFinalization
Claus Gittinger <cg@exept.de>
parents: 5472
diff changeset
  3891
    "register mySelf for later finalization.
d76d23964321 added #reRegisterForFinalization
Claus Gittinger <cg@exept.de>
parents: 5472
diff changeset
  3892
     Once registered, the executor of the receiver will receive a #disposed message when
d76d23964321 added #reRegisterForFinalization
Claus Gittinger <cg@exept.de>
parents: 5472
diff changeset
  3893
     the receiver is garbage collected."
5408
5287fd5f6ab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5402
diff changeset
  3894
5287fd5f6ab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5402
diff changeset
  3895
    FinalizationLobby isNil ifTrue:[
5287fd5f6ab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5402
diff changeset
  3896
        FinalizationLobby := Registry new.
5287fd5f6ab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5402
diff changeset
  3897
    ].
5287fd5f6ab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5402
diff changeset
  3898
    FinalizationLobby register:self
5287fd5f6ab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5402
diff changeset
  3899
5287fd5f6ab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5402
diff changeset
  3900
!
5287fd5f6ab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5402
diff changeset
  3901
5287fd5f6ab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5402
diff changeset
  3902
unregisterForFinalization
5479
490e589f98d3 comment
Claus Gittinger <cg@exept.de>
parents: 5476
diff changeset
  3903
    "unregister mySelf from later finalization"
5408
5287fd5f6ab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5402
diff changeset
  3904
5287fd5f6ab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5402
diff changeset
  3905
    FinalizationLobby notNil ifTrue:[
5287fd5f6ab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5402
diff changeset
  3906
        FinalizationLobby unregister:self
5287fd5f6ab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5402
diff changeset
  3907
    ]
3330
5e0af0183446 Add dummy #finalize (as in ST80)
Stefan Vogel <sv@exept.de>
parents: 3317
diff changeset
  3908
! !
5e0af0183446 Add dummy #finalize (as in ST80)
Stefan Vogel <sv@exept.de>
parents: 3317
diff changeset
  3909
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3910
!Object methodsFor:'initialization'!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3911
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3912
initialize
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3913
    "just to ignore initialize to objects which do not need it"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3914
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3915
    ^ self
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3916
! !
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3917
1751
0902cadafee2 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1705
diff changeset
  3918
!Object methodsFor:'interest'!
0902cadafee2 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1705
diff changeset
  3919
0902cadafee2 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1705
diff changeset
  3920
addInterest:anInterest
1762
e7267ff590ff Fix misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1751
diff changeset
  3921
    "install an interest forwarder.
1231
4f457f654e57 interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  3922
     Here, we use the nonWeakDependencies."
4f457f654e57 interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  3923
1751
0902cadafee2 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1705
diff changeset
  3924
    self addNonWeakDependent:anInterest
0902cadafee2 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1705
diff changeset
  3925
0902cadafee2 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1705
diff changeset
  3926
    "Created: 14.10.1996 / 22:27:34 / stefan"
1231
4f457f654e57 interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  3927
!
4f457f654e57 interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  3928
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3929
expressInterestIn:aspect for:anObject sendBack:aSelector
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3930
    "arrange for aSelector to be sent to anObject whenever the receiver
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3931
     changes aspect."
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3932
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3933
    "/ for now, use an interestConverter, which is somewhat less efficient.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3934
    "/ In the future, a more intelligent DependencyCollection class is planned for
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3935
1751
0902cadafee2 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1705
diff changeset
  3936
    self addInterest:(InterestConverter 
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  3937
                            destination:anObject 
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  3938
                            selector:aSelector 
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  3939
                            aspect:aspect)
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3940
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3941
    "
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3942
     |p b|
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3943
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  3944
     b := [Transcript showCR:' -> the point changed'].
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3945
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3946
     p := Point new.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  3947
     Transcript showCR:'interest in #foo:'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3948
     p expressInterestIn:#foo for:b sendBack:#value.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3949
     p x:1.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  3950
     Transcript showCR:'now changing #bar ... (expect no notification)'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3951
     p changed:#bar.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3952
     Transcript cr.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3953
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3954
     Delay waitForSeconds:1.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  3955
     Transcript showCR:'now changing #foo ... (expect notification)'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3956
     p changed:#foo.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3957
     Transcript cr.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3958
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3959
     Delay waitForSeconds:1.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  3960
     Transcript showCR:'no more interest in #foo:'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3961
     p retractInterestIn:#foo for:b.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  3962
     Transcript showCR:'now changing #foo ... (expect no notification)'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3963
     p changed:#foo.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3964
     Transcript cr.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3965
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3966
     Delay waitForSeconds:1.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  3967
     Transcript showCR:'interest in #bar now:'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3968
     p expressInterestIn:#bar for:b sendBack:#value.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  3969
     Transcript showCR:'now changing #foo ... (expect no notification)'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3970
     p changed:#foo.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  3971
     Transcript showCR:'now changing #bar ... (expect notification)'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3972
     p changed:#bar.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3973
     Transcript cr.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3974
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3975
     Delay waitForSeconds:1.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  3976
     Transcript showCR:'interest in #foo now:'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3977
     p expressInterestIn:#foo for:b sendBack:#value.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  3978
     Transcript showCR:'now changing #foo ... (expect notification)'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3979
     p changed:#foo.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  3980
     Transcript showCR:'now changing #bar ... (expect notification)'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3981
     p changed:#bar.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3982
     Transcript cr.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3983
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3984
     Delay waitForSeconds:1.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  3985
     Transcript showCR:'no more interests:'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3986
     p retractInterestsFor:b.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  3987
     Transcript showCR:'now changing #foo ... (expect no notification)'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3988
     p changed:#foo.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  3989
     Transcript showCR:'now changing #bar...  (expect no notification)'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3990
     p changed:#bar.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3991
     Transcript cr.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3992
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3993
     p release.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3994
    "
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3995
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3996
    "Created: 19.4.1996 / 10:26:22 / cg"
1231
4f457f654e57 interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  3997
    "Modified: 19.4.1996 / 12:34:08 / cg"
1751
0902cadafee2 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1705
diff changeset
  3998
    "Modified: 14.10.1996 / 22:28:20 / stefan"
0902cadafee2 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1705
diff changeset
  3999
!
0902cadafee2 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1705
diff changeset
  4000
0902cadafee2 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1705
diff changeset
  4001
interests
3254
40b21297d9ab #interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents: 3228
diff changeset
  4002
    "return a Collection of interests - empty if there is none.
1751
0902cadafee2 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1705
diff changeset
  4003
     Here, we use the nonWeakDependents for interests."
1231
4f457f654e57 interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  4004
4f457f654e57 interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  4005
    ^ self nonWeakDependents
4f457f654e57 interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  4006
3254
40b21297d9ab #interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents: 3228
diff changeset
  4007
    "Created: / 14.10.1996 / 22:20:51 / stefan"
40b21297d9ab #interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents: 3228
diff changeset
  4008
    "Modified: / 30.1.1998 / 14:07:35 / cg"
40b21297d9ab #interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents: 3228
diff changeset
  4009
!
40b21297d9ab #interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents: 3228
diff changeset
  4010
40b21297d9ab #interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents: 3228
diff changeset
  4011
interestsFor:someOne
40b21297d9ab #interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents: 3228
diff changeset
  4012
    "return a collection of interests of someOne - empty if there is none."
40b21297d9ab #interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents: 3228
diff changeset
  4013
40b21297d9ab #interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents: 3228
diff changeset
  4014
    |coll deps|
40b21297d9ab #interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents: 3228
diff changeset
  4015
40b21297d9ab #interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents: 3228
diff changeset
  4016
    deps := self interests.
40b21297d9ab #interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents: 3228
diff changeset
  4017
    deps size == 0 ifTrue:[^ #()].
40b21297d9ab #interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents: 3228
diff changeset
  4018
40b21297d9ab #interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents: 3228
diff changeset
  4019
    coll := IdentitySet new.
40b21297d9ab #interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents: 3228
diff changeset
  4020
40b21297d9ab #interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents: 3228
diff changeset
  4021
    deps do:[:dep |
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4022
        (dep isMemberOf:InterestConverter) ifTrue:[
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4023
            dep destination == someOne ifTrue:[
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4024
                coll add:dep.
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4025
            ]
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4026
        ]
3254
40b21297d9ab #interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents: 3228
diff changeset
  4027
    ].
40b21297d9ab #interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents: 3228
diff changeset
  4028
    ^ coll
40b21297d9ab #interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents: 3228
diff changeset
  4029
40b21297d9ab #interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents: 3228
diff changeset
  4030
    "Created: / 30.1.1998 / 14:02:26 / cg"
40b21297d9ab #interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents: 3228
diff changeset
  4031
    "Modified: / 30.1.1998 / 14:08:24 / cg"
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  4032
!
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  4033
3960
397537bccf97 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3922
diff changeset
  4034
onChangeEvaluate:aBlock
397537bccf97 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3922
diff changeset
  4035
    "arrange for aBlock to be evaluated whenever the receiver changes."
397537bccf97 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3922
diff changeset
  4036
397537bccf97 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3922
diff changeset
  4037
    ^ self onChangeSend:#value to:aBlock
397537bccf97 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3922
diff changeset
  4038
397537bccf97 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3922
diff changeset
  4039
    "Created: / 29.1.1999 / 16:01:22 / cg"
397537bccf97 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3922
diff changeset
  4040
!
397537bccf97 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3922
diff changeset
  4041
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  4042
onChangeSend:aSelector to:anObject
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  4043
    "arrange for aSelector to be sent to anObject whenever the receiver
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  4044
     changes."
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  4045
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  4046
    "/ for now, use an interestConverter, which is somewhat less efficient.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  4047
    "/ In the future, a more intelligent DependencyCollection class is planned for
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  4048
1751
0902cadafee2 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1705
diff changeset
  4049
    self addInterest:(InterestConverter 
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4050
                          destination:anObject 
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4051
                          selector:aSelector)
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  4052
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  4053
    "
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  4054
     |p b|
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  4055
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  4056
     b := [Transcript showCR:'the point changed'].
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  4057
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  4058
     p := Point new.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  4059
     p onChangeSend:#value to:b.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  4060
     p x:1.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  4061
     Transcript showCR:'now changing'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  4062
     p changed.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  4063
     Transcript cr.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  4064
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  4065
     Delay waitForSeconds:1.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  4066
     Transcript showCR:'now changing'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  4067
     p changed.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  4068
     Transcript cr.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  4069
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  4070
     Delay waitForSeconds:1.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  4071
     Transcript showCR:'no more interest'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  4072
     p retractInterestsFor:b.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  4073
     Transcript showCR:'now changing again'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  4074
     p changed.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  4075
     Transcript cr.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  4076
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  4077
     Delay waitForSeconds:1.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  4078
     Transcript showCR:'interest again'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  4079
     p onChangeSend:#value to:b.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  4080
     Transcript showCR:'now changing again'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  4081
     p changed.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  4082
     Transcript cr.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  4083
    "
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  4084
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  4085
    "Created: 19.4.1996 / 10:26:38 / cg"
1231
4f457f654e57 interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  4086
    "Modified: 19.4.1996 / 12:34:26 / cg"
1751
0902cadafee2 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1705
diff changeset
  4087
    "Modified: 14.10.1996 / 22:28:27 / stefan"
0902cadafee2 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1705
diff changeset
  4088
!
0902cadafee2 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1705
diff changeset
  4089
0902cadafee2 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1705
diff changeset
  4090
removeInterest:anInterest
0902cadafee2 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1705
diff changeset
  4091
    "remove an interest forwarder.
1231
4f457f654e57 interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  4092
     Here, we use the nonWeakDependencies."
4f457f654e57 interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  4093
1751
0902cadafee2 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1705
diff changeset
  4094
    self removeNonWeakDependent:anInterest
0902cadafee2 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1705
diff changeset
  4095
0902cadafee2 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1705
diff changeset
  4096
    "Created: 14.10.1996 / 22:21:59 / stefan"
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  4097
!
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  4098
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  4099
retractInterestIn:aspect for:someOne
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  4100
    "remove the interest of someOne in the receiver changing aspect
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  4101
     (as installed with #expressInterestIn:for:sendBack:)."
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  4102
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  4103
    "/ for now, remove the interestConverter.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  4104
    "/ In the future, a more intelligent DependencyCollection class is planned for
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  4105
3254
40b21297d9ab #interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents: 3228
diff changeset
  4106
    "/ cannot removeDependent within the loop - the collection rehashes
40b21297d9ab #interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents: 3228
diff changeset
  4107
40b21297d9ab #interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents: 3228
diff changeset
  4108
    |deps coll|
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  4109
1751
0902cadafee2 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1705
diff changeset
  4110
    deps := self interests.
3254
40b21297d9ab #interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents: 3228
diff changeset
  4111
    deps size ~~ 0 ifTrue:[
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4112
        coll := IdentitySet new.
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4113
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4114
        deps do:[:dep |
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4115
            (dep isMemberOf:InterestConverter) ifTrue:[
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4116
                dep destination == someOne ifTrue:[
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4117
                    dep aspect == aspect ifTrue:[
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4118
                        self removeInterest:dep.
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4119
                        ^ self
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4120
                    ]
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4121
                ]
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4122
            ]
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4123
        ].
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4124
        coll do:[:dep |
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4125
            self removeInterest:dep.
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4126
        ].
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  4127
    ].
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  4128
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  4129
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  4130
    "
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  4131
     |p b|
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  4132
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  4133
     b := [Transcript showCR:'the point changed'].
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  4134
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  4135
     p := Point new.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  4136
     Transcript showCR:'interest in #foo'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  4137
     p expressInterestIn:#foo for:b sendBack:#value.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  4138
     p x:1.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  4139
     Transcript showCR:'now changing #bar'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  4140
     p changed:#bar.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  4141
     Transcript cr.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  4142
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  4143
     Delay waitForSeconds:1.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  4144
     Transcript showCR:'now changing #foo'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  4145
     p changed:#foo.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  4146
     Transcript cr.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  4147
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  4148
     Delay waitForSeconds:1.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  4149
     Transcript showCR:'no more interest in #foo'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  4150
     p retractInterestIn:#foo for:b.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  4151
     Transcript showCR:'now changing #foo'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  4152
     p changed:#foo.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  4153
     Transcript cr.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  4154
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  4155
     Delay waitForSeconds:1.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  4156
     Transcript showCR:'interest in #bar now'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  4157
     p expressInterestIn:#bar for:b sendBack:#value.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  4158
     Transcript showCR:'now changing #foo'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  4159
     p changed:#foo.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  4160
     Transcript showCR:'now changing #bar'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  4161
     p changed:#bar.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  4162
     Transcript cr.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  4163
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  4164
     Delay waitForSeconds:1.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  4165
     Transcript showCR:'interest in #foo now'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  4166
     p expressInterestIn:#foo for:b sendBack:#value.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  4167
     Transcript showCR:'now changing #foo'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  4168
     p changed:#foo.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  4169
     Transcript showCR:'now changing #bar'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  4170
     p changed:#bar.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  4171
     Transcript cr.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  4172
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  4173
     Delay waitForSeconds:1.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  4174
     Transcript showCR:'no more interests'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  4175
     p retractInterestsFor:b.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  4176
     Transcript showCR:'now changing #foo'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  4177
     p changed:#foo.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  4178
     Transcript showCR:'now changing #bar'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  4179
     p changed:#bar.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  4180
     Transcript cr.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  4181
    "
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  4182
3254
40b21297d9ab #interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents: 3228
diff changeset
  4183
    "Created: / 19.4.1996 / 10:27:11 / cg"
40b21297d9ab #interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents: 3228
diff changeset
  4184
    "Modified: / 14.10.1996 / 22:21:19 / stefan"
40b21297d9ab #interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents: 3228
diff changeset
  4185
    "Modified: / 30.1.1998 / 14:05:34 / cg"
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  4186
!
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  4187
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  4188
retractInterestsFor:someOne
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  4189
    "remove the interest of someOne in the receiver 
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  4190
     (as installed with #onChangeSend:to:)."
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  4191
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  4192
    "/ for now, remove the interestConverter.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  4193
    "/ In the future, a more intelligent DependencyCollection class is planned for
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  4194
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  4195
    |coll deps|
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  4196
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  4197
    "/ cannot removeDependent within the loop - the collection rehashes
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  4198
1751
0902cadafee2 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1705
diff changeset
  4199
    deps := self interests.
3254
40b21297d9ab #interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents: 3228
diff changeset
  4200
    deps size ~~ 0 ifTrue:[
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4201
        coll := IdentitySet new.
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4202
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4203
        deps do:[:dep |
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4204
            (dep isMemberOf:InterestConverter) ifTrue:[
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4205
                dep destination == someOne ifTrue:[
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4206
                    coll add:dep.
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4207
                ]
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4208
            ]
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4209
        ].
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4210
        coll do:[:dep |
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4211
            self removeInterest:dep.
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4212
        ].
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  4213
    ].
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  4214
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  4215
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  4216
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  4217
    "
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  4218
     |p b|
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  4219
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  4220
     b := [Transcript showCR:'the point changed'].
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  4221
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  4222
     p := Point new.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  4223
     p onChangeSend:#value to:b.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  4224
     p x:1.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  4225
     Transcript showCR:'now changing'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  4226
     p changed.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  4227
     Transcript cr.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  4228
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  4229
     Delay waitForSeconds:1.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  4230
     Transcript showCR:'now changing'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  4231
     p changed.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  4232
     Transcript cr.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  4233
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  4234
     Delay waitForSeconds:1.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  4235
     Transcript showCR:'no more interest'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  4236
     p retractInterestsFor:b.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  4237
     Transcript showCR:'now changing again'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  4238
     p changed.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  4239
     Transcript cr.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  4240
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  4241
     Delay waitForSeconds:1.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  4242
     Transcript showCR:'interest again'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  4243
     p onChangeSend:#value to:b.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  4244
     Transcript showCR:'now changing again'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  4245
     p changed.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  4246
     Transcript cr.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  4247
    "
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  4248
3254
40b21297d9ab #interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents: 3228
diff changeset
  4249
    "Created: / 19.4.1996 / 10:23:46 / cg"
40b21297d9ab #interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents: 3228
diff changeset
  4250
    "Modified: / 14.10.1996 / 22:21:25 / stefan"
40b21297d9ab #interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents: 3228
diff changeset
  4251
    "Modified: / 30.1.1998 / 14:04:52 / cg"
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  4252
! !
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  4253
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4254
!Object methodsFor:'interrupt handling'!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4255
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4256
childSignalInterrupt
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4257
    "death of a child process (unix process) - do nothing"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4258
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4259
    ^ self
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4260
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4261
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4262
customInterrupt
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  4263
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  4264
4522
29a6625dc7b1 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 4520
diff changeset
  4265
    "a custom interrupt - but no handler has defined"
29a6625dc7b1 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 4520
diff changeset
  4266
29a6625dc7b1 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 4520
diff changeset
  4267
    self error:'custom interrupt' mayProceed:true
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4268
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4269
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4270
errorInterrupt:errorID with:aParameter
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4271
    "subsystem error. The arguments errorID and aParameter are the values passed
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4272
     to the 'errorInterruptWithIDAndParameter(id, param)' function, 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4273
     which can be called from C subsystems to raise an (asynchronous)
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4274
     error exception.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4275
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4276
     Currently, this is used to map XErrors to smalltalk errors, but can be
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4277
     used from other C subsystems too, to upcast errors.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4278
     Especially, for subsystems which call errorHandler functions asynchronously.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4279
     IDs (currently) used:
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4280
        #DisplayError ..... x-error interrupt
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4281
        #XtError      ..... xt-error interrupt (Xt interface is not yet published)
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  4282
    "
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4283
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4284
    |handler|
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4285
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4286
    handler := ObjectMemory registeredErrorInterruptHandlers at:errorID ifAbsent:nil.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4287
    handler notNil ifTrue:[
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4288
        "/
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4289
        "/ handler found; let it do whatever it wants ...
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4290
        "/
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4291
        handler errorInterrupt:errorID with:aParameter.
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4292
        ^ self
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4293
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4294
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4295
    "/
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4296
    "/ no handler - raise errorSignal passing the errorId as parameter
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4297
    "/
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4298
    ^ ErrorSignal 
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4299
        raiseRequestWith:errorID 
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4300
        errorString:('Subsystem error. ErrorID = ' , errorID printString)
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4301
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4302
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4303
exceptionInterrupt
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  4304
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  4305
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4306
    "exception interrupt - enter debugger"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4307
4522
29a6625dc7b1 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 4520
diff changeset
  4308
    self error:'exception Interrupt' mayProceed:true
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4309
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4310
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4311
fpExceptionInterrupt
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  4312
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  4313
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4314
    "a floating point exception occured - this one
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4315
     has to be handled differently since it comes asynchronous
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4316
     on some machines (for example, on machines with a separate FPU
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4317
     or superscalar architectures. Also, errors from within primitive code
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4318
     (or library functions such as GL) are sent via the Unix-signal
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4319
     mechanism this way."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4320
3396
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4321
    |where rec|
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4322
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4323
    where := thisContext sender.
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4324
    rec := where receiver.
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4325
    rec isNumber ifTrue:[
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4326
        ^ rec class
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4327
            raise:#domainErrorSignal
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4328
            receiver:rec
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4329
            selector:where selector
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4330
            arguments:(where args asArray)
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4331
            errorString:'floating point exception'
3396
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4332
    ].
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4333
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4334
    "/ could be in some C-library ...
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4335
    ^ Float domainErrorSignal raise
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4336
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4337
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4338
internalError:msg
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  4339
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  4340
2227
eb1e28c62f14 use an extra signal for internal errors
Claus Gittinger <cg@exept.de>
parents: 2209
diff changeset
  4341
    "this is triggered, when VM hits some bad error,
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4342
     such as corrupted class, corrupted method/selector array
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4343
     etc. The argument string gives some more information on what happened.
2227
eb1e28c62f14 use an extra signal for internal errors
Claus Gittinger <cg@exept.de>
parents: 2209
diff changeset
  4344
     (for example, if you set an objects class to a non-behavior, nil etc.).
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4345
     Its not guaranteed, that the system is in a working condition once
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4346
     this error occurred ...."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4347
4558
94044dccefab checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4537
diff changeset
  4348
    InternalErrorSignal raiseWith:self errorString:msg
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4349
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4350
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4351
ioInterrupt
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  4352
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  4353
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4354
    "I/O (SIGIO/SIGPOLL) interrupt (supposed to be sent to Processor).
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4355
     If we arrive here, there is either no handler (ObjMem>>ioInterruptHandler)
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4356
     or it does not understand the ioInterrupt message.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4357
     In any case, this is a sign of some big trouble. Enter debugger."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4358
4522
29a6625dc7b1 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 4520
diff changeset
  4359
    self error:'I/O Interrupt - but no handler' mayProceed:true
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4360
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4361
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4362
memoryInterrupt
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  4363
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  4364
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4365
    "out-of-memory interrupt and no handler - enter debugger"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4366
4522
29a6625dc7b1 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 4520
diff changeset
  4367
    self error:'almost out of memory' mayProceed:true
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4368
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4369
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4370
recursionInterrupt
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  4371
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  4372
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4373
    "recursion limit (actually: stack overflow) interrupt.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4374
     This interrupt is triggered, when a process stack grows above
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4375
     its stackLimit - usually, this leads into the debugger, but
2689
ada9b102abcf typo fix
Claus Gittinger <cg@exept.de>
parents: 2673
diff changeset
  4376
     could be caught and the stackLimit increased in the handler.
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4377
     At the time we arrive here, the system has still some stack 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4378
     as a reserve so we can continue to do some useful work or cleanup or
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4379
     debugging for a while.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4380
     If the signal is ignored, and the stack continues to grow, there
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4381
     will be a few more chances (and more interrupts) before the VM
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4382
     hard-terminates the process."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4383
5194
262d8638d2ef *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5180
diff changeset
  4384
    |con remaining|
262d8638d2ef *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5180
diff changeset
  4385
262d8638d2ef *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5180
diff changeset
  4386
    (con := thisContext) isRecursive ifFalse:[
4884
988431a226b7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4873
diff changeset
  4387
"/        Processor activeProcess usedStackSize < Processor activeProcess maximumStackSize ifTrue:[
988431a226b7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4873
diff changeset
  4388
"/            "/ mhmh - it hit me, but I am not responsible ...
988431a226b7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4873
diff changeset
  4389
"/            'Stray recursionInterrupt ...' infoPrintCR.
988431a226b7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4873
diff changeset
  4390
"/            ^ self
988431a226b7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4873
diff changeset
  4391
"/        ].
5194
262d8638d2ef *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5180
diff changeset
  4392
        'Object [info]: recursionInterrupt from:' printCR.
262d8638d2ef *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5180
diff changeset
  4393
        con := con sender.
262d8638d2ef *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5180
diff changeset
  4394
        remaining := 50.
262d8638d2ef *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5180
diff changeset
  4395
        [con notNil and:[remaining > 0]] whileTrue:[
262d8638d2ef *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5180
diff changeset
  4396
            '| ' print. con fullPrint.
262d8638d2ef *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5180
diff changeset
  4397
            con := con sender.
262d8638d2ef *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5180
diff changeset
  4398
            remaining := remaining - 1
262d8638d2ef *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5180
diff changeset
  4399
        ].
4815
75c3243e523a ignore stray recursion interrupts.
Claus Gittinger <cg@exept.de>
parents: 4808
diff changeset
  4400
        ^ RecursionInterruptSignal raise
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4401
    ]
4815
75c3243e523a ignore stray recursion interrupts.
Claus Gittinger <cg@exept.de>
parents: 4808
diff changeset
  4402
75c3243e523a ignore stray recursion interrupts.
Claus Gittinger <cg@exept.de>
parents: 4808
diff changeset
  4403
    "Modified: / 25.9.1999 / 18:28:11 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4404
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4405
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4406
schedulerInterrupt
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  4407
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  4408
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4409
    "scheduler interrupt (supposed to be sent to Processor).
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4410
     If we arrive here, either the Processor does not understand it,
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4411
     or it has been set to nil. In any case, this is a sign of some
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4412
     big trouble. Enter debugger."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4413
4522
29a6625dc7b1 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 4520
diff changeset
  4414
    self error:'schedulerInterrupt - but no Processor' mayProceed:true
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4415
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4416
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4417
signalInterrupt:signalNumber
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  4418
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  4419
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4420
    "unix signal occured - some signals are handled as Smalltalk Exceptions 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4421
     (SIGPIPE), others (SIGBUS) are rather fatal ...
2774
5a7467b9a531 better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents: 2773
diff changeset
  4422
     In any case, IF a smalltalk-signal has been connected to the OS signal,
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4423
     that one is raised.
2774
5a7467b9a531 better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents: 2773
diff changeset
  4424
     Otherwise, a dialog is shown, asking the user on how to handle the
5a7467b9a531 better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents: 2773
diff changeset
  4425
     signal.
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4426
     TODO: add another argument, giving more detailed signal info (PC, VADDR,
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4427
     exact cause etc.). This helps if segvs occur in primitive code.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4428
     Currently (temporary kludge), these are passed as global variables."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4429
2773
c9459bd8400d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2704
diff changeset
  4430
    |box name here sig ignorable titles actions badContext msg pc addr
2774
5a7467b9a531 better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents: 2773
diff changeset
  4431
     action title|
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4432
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4433
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4434
     special case - since SIGPIPE has an ST-signal associated
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4435
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4436
    (signalNumber == 13) ifTrue:[
4535
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  4437
        "SIGPIPE - write on a pipe with no one to read"
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  4438
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  4439
        ^ PipeStream brokenPipeSignal raise.
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4440
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4441
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4442
    "if there has been an ST-signal installed, use it ..."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4443
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4444
    sig := OperatingSystem operatingSystemSignal:signalNumber.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4445
    sig notNil ifTrue:[
4535
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  4446
        ^ sig raise
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4447
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4448
3423
b4a43b4f098b new signal: osSignalInterruptSignal;
Claus Gittinger <cg@exept.de>
parents: 3418
diff changeset
  4449
    "/ if handled, raise OSSignalInterruptSignal
b4a43b4f098b new signal: osSignalInterruptSignal;
Claus Gittinger <cg@exept.de>
parents: 3418
diff changeset
  4450
b4a43b4f098b new signal: osSignalInterruptSignal;
Claus Gittinger <cg@exept.de>
parents: 3418
diff changeset
  4451
    OSSignalInterruptSignal isHandled ifTrue:[
4535
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  4452
        ^ OSSignalInterruptSignal raiseWith:signalNumber
3423
b4a43b4f098b new signal: osSignalInterruptSignal;
Claus Gittinger <cg@exept.de>
parents: 3418
diff changeset
  4453
    ].
b4a43b4f098b new signal: osSignalInterruptSignal;
Claus Gittinger <cg@exept.de>
parents: 3418
diff changeset
  4454
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4455
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4456
     ... otherwise , bring up a box asking for what to do ...
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4457
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4458
    name := OperatingSystem nameForSignal:signalNumber.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4459
    here := thisContext.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4460
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4461
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4462
     the context, in which the signal occurred:
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4463
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4464
    badContext := here sender.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4465
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4466
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4467
     ungrab - in case it happened in a box/popupview
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4468
     otherwise display stays locked
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4469
    "
2851
856557e261a3 ungrab all screens in case of an error
Claus Gittinger <cg@exept.de>
parents: 2829
diff changeset
  4470
"/    Display notNil ifTrue:[
856557e261a3 ungrab all screens in case of an error
Claus Gittinger <cg@exept.de>
parents: 2829
diff changeset
  4471
"/        Display ungrabPointer.
856557e261a3 ungrab all screens in case of an error
Claus Gittinger <cg@exept.de>
parents: 2829
diff changeset
  4472
"/        Display ungrabKeyboard.
856557e261a3 ungrab all screens in case of an error
Claus Gittinger <cg@exept.de>
parents: 2829
diff changeset
  4473
"/    ].
856557e261a3 ungrab all screens in case of an error
Claus Gittinger <cg@exept.de>
parents: 2829
diff changeset
  4474
    Screen notNil ifTrue:[
4535
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  4475
        Screen allScreens do:[:aScreen |
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  4476
            aScreen ungrabPointer.
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  4477
            aScreen ungrabKeyboard.
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  4478
        ]
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4479
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4480
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4481
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4482
     SIGBUS, SIGSEGV and SIGILL do not make sense to ignore (i.e. continue)
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4483
     since the system will retry the faulty instruction, which leads to
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4484
     another signal - to avoid frustration, better not offer this option.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4485
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4486
    ignorable := (signalNumber ~~ OperatingSystem sigBUS)
4535
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  4487
                  and:[signalNumber ~~ OperatingSystem sigILL
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  4488
                  and:[signalNumber ~~ OperatingSystem sigSEGV]].
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4489
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4490
    ignorable ifFalse:[
4535
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  4491
        here isRecursive ifTrue:[
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  4492
            'Object [hard error]: signal ' errorPrint. signalNumber errorPrintCR.
4537
972484195528 minidebugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4535
diff changeset
  4493
            MiniDebugger 
972484195528 minidebugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4535
diff changeset
  4494
                enterWithMessage:'recursive signal' 
972484195528 minidebugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4535
diff changeset
  4495
                mayProceed:true.
4535
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  4496
            ^ self
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  4497
        ].
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  4498
        "
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  4499
         a hard signal - go into debugger immediately
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  4500
        "
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  4501
        msg := 'OS-signal: ', name.
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  4502
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  4503
        "/ the IRQ-PC is passed as low-hi, to avoid the need
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  4504
        "/ to allocate a LargeInteger in the VM during signal
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  4505
        "/ time. I know, this is ugly.
3418
8aafd5280caf construct IRQ-addr using correct shift amounts (alpha)
Claus Gittinger <cg@exept.de>
parents: 3398
diff changeset
  4506
        
4535
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  4507
        InterruptPcLow notNil ifTrue:[
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  4508
            pc := InterruptPcLow + (InterruptPcHi bitShift:(SmallInteger maxBits + 1 // 2)).
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  4509
            pc ~~ 0 ifTrue:[
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  4510
                msg := msg , ' PC=' , (pc printStringRadix:16)
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  4511
            ].
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  4512
        ].
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  4513
        InterruptAddrLow notNil ifTrue:[
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  4514
            addr := InterruptAddrLow + (InterruptAddrHi bitShift:(SmallInteger maxBits + 1 // 2)).
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  4515
            addr ~~ 0 ifTrue:[
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  4516
                msg := msg , ' ADDR=' , (addr printStringRadix:16)
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  4517
            ].
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  4518
        ].
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  4519
        Debugger enter:here withMessage:msg mayProceed:true. 
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  4520
        badContext return.
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  4521
        ^ nil.
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4522
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4523
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4524
    OptionBox isNil ifTrue:[
4535
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  4525
        "
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  4526
         a system without GUI ...
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  4527
         go into minidebugger (if there is one)
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  4528
        "
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  4529
        MiniDebugger isNil ifTrue:[
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  4530
            "
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  4531
             a system without debugging facilities
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  4532
             (i.e. a standalone system)
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  4533
             output a message and exit.
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  4534
            "
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  4535
            ('Object [error]: exit due to Signal ' , name , ' - and no debugger.') errorPrintCR.
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  4536
            Smalltalk exit.
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  4537
        ].
4537
972484195528 minidebugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4535
diff changeset
  4538
        MiniDebugger 
972484195528 minidebugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4535
diff changeset
  4539
            enterWithMessage:'Signal caught (' , name, ')' 
972484195528 minidebugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4535
diff changeset
  4540
            mayProceed:true.
4535
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  4541
        ^ self
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4542
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4543
2774
5a7467b9a531 better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents: 2773
diff changeset
  4544
    titles := #('dump core' 'exit ST/X').
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4545
    actions := Array 
4535
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  4546
                 with:[Smalltalk fatalAbort]
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  4547
                 with:[Smalltalk exit].
2773
c9459bd8400d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2704
diff changeset
  4548
2774
5a7467b9a531 better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents: 2773
diff changeset
  4549
    action := nil.
5a7467b9a531 better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents: 2773
diff changeset
  4550
    title := 'OS Signal caught (' , name, ')'.
5a7467b9a531 better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents: 2773
diff changeset
  4551
    title := (title , '\[in ST-process: ' , Processor activeProcess nameOrId ,']') withCRs.
5a7467b9a531 better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents: 2773
diff changeset
  4552
5a7467b9a531 better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents: 2773
diff changeset
  4553
    "/ if cought while in the scheduler or event dispatcher,
5a7467b9a531 better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents: 2773
diff changeset
  4554
    "/ a modal dialog is not possible ...
5a7467b9a531 better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents: 2773
diff changeset
  4555
    "/ (therefore, debug & return make no sense)
5a7467b9a531 better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents: 2773
diff changeset
  4556
5a7467b9a531 better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents: 2773
diff changeset
  4557
    Processor activeProcess isSystemProcess ifFalse:[
4535
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  4558
        titles := #('abort' 'debug') , titles.
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  4559
        actions := (Array
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  4560
                        with:[action := #abort]
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  4561
                        with:[action := #debug]) , actions.
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  4562
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  4563
        badContext canReturn ifTrue:[
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  4564
            titles := #('return') , titles.
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  4565
            actions := (Array with:[action := #return]) , actions.
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  4566
        ].
2774
5a7467b9a531 better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents: 2773
diff changeset
  4567
    ].
5a7467b9a531 better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents: 2773
diff changeset
  4568
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4569
    ignorable ifTrue:[
4535
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  4570
        titles := titles, #('ignore').
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  4571
        actions := actions , (Array with:[action := #ignore]).
2774
5a7467b9a531 better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents: 2773
diff changeset
  4572
    ].
5a7467b9a531 better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents: 2773
diff changeset
  4573
5a7467b9a531 better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents: 2773
diff changeset
  4574
    box := OptionBox 
4535
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  4575
                title:title
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  4576
                numberOfOptions:actions size.
2774
5a7467b9a531 better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents: 2773
diff changeset
  4577
    ignorable ifTrue:[
4535
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  4578
        box defaultButtonIndex:(actions size)
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4579
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4580
    box buttonTitles:titles.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4581
    box actions:actions.
2773
c9459bd8400d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2704
diff changeset
  4582
    box showAtPointer.
c9459bd8400d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2704
diff changeset
  4583
2774
5a7467b9a531 better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents: 2773
diff changeset
  4584
    action == #return ifTrue:[
4535
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  4585
        badContext return
2774
5a7467b9a531 better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents: 2773
diff changeset
  4586
    ].
5a7467b9a531 better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents: 2773
diff changeset
  4587
5a7467b9a531 better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents: 2773
diff changeset
  4588
    action == #abort ifTrue:[
4535
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  4589
        AbortSignal raise.
2774
5a7467b9a531 better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents: 2773
diff changeset
  4590
    ].
5a7467b9a531 better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents: 2773
diff changeset
  4591
5a7467b9a531 better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents: 2773
diff changeset
  4592
    action == #debug ifTrue:[
4535
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  4593
        Debugger enter:here withMessage:('Signal ', name) mayProceed:true. 
2774
5a7467b9a531 better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents: 2773
diff changeset
  4594
    ].
5a7467b9a531 better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents: 2773
diff changeset
  4595
3418
8aafd5280caf construct IRQ-addr using correct shift amounts (alpha)
Claus Gittinger <cg@exept.de>
parents: 3398
diff changeset
  4596
    "Modified: / 4.5.1998 / 20:39:16 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4597
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4598
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4599
spyInterrupt
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  4600
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  4601
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4602
    "spy interrupt and no handler - enter debugger"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4603
4522
29a6625dc7b1 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 4520
diff changeset
  4604
    self error:'spy Interrupt - but no handler' mayProceed:true
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4605
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4606
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4607
timerInterrupt
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  4608
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  4609
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4610
    "timer interrupt and no handler - enter debugger"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4611
4522
29a6625dc7b1 error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 4520
diff changeset
  4612
    self error:'timer Interrupt - but no handler' mayProceed:true
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4613
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4614
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4615
userInterrupt
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  4616
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  4617
1792
ba0dc099895c comment
Claus Gittinger <cg@exept.de>
parents: 1788
diff changeset
  4618
    "user (^c) interrupt.
ba0dc099895c comment
Claus Gittinger <cg@exept.de>
parents: 1788
diff changeset
  4619
     This is typically sent by the VM, when a ctrl-C is typed at the
ba0dc099895c comment
Claus Gittinger <cg@exept.de>
parents: 1788
diff changeset
  4620
     controlling tty (i.e. in the xterm)."
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4621
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4622
    UserInterruptSignal raise
1788
0c71ba975d34 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1780
diff changeset
  4623
!
0c71ba975d34 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1780
diff changeset
  4624
0c71ba975d34 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1780
diff changeset
  4625
userInterruptIn:aContext
0c71ba975d34 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1780
diff changeset
  4626
    "{ Pragma: +optSpace }"
0c71ba975d34 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1780
diff changeset
  4627
0c71ba975d34 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1780
diff changeset
  4628
    "user (^c) interrupt - enter debugger, but show aContext
1792
ba0dc099895c comment
Claus Gittinger <cg@exept.de>
parents: 1788
diff changeset
  4629
     as top-context. 
ba0dc099895c comment
Claus Gittinger <cg@exept.de>
parents: 1788
diff changeset
  4630
     This is used to hide any intermediate scheduler contexts, 
ba0dc099895c comment
Claus Gittinger <cg@exept.de>
parents: 1788
diff changeset
  4631
     in case of an interrupted process. Typically, this is sent by
ba0dc099895c comment
Claus Gittinger <cg@exept.de>
parents: 1788
diff changeset
  4632
     the WindowGroup, when a keyboardEvent for the ctrl-C key is
ba0dc099895c comment
Claus Gittinger <cg@exept.de>
parents: 1788
diff changeset
  4633
     processed."
1788
0c71ba975d34 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1780
diff changeset
  4634
4634
8dd9397431b4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4620
diff changeset
  4635
    <context: #return>
8dd9397431b4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4620
diff changeset
  4636
4558
94044dccefab checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4537
diff changeset
  4637
    UserInterruptSignal raiseRequestWith:nil errorString:nil in:aContext
4452
3d050f505a0a Raise proceedable signals proceedable.
Stefan Vogel <sv@exept.de>
parents: 4392
diff changeset
  4638
3d050f505a0a Raise proceedable signals proceedable.
Stefan Vogel <sv@exept.de>
parents: 4392
diff changeset
  4639
    "Created: / 18.10.1996 / 20:46:04 / cg"
3d050f505a0a Raise proceedable signals proceedable.
Stefan Vogel <sv@exept.de>
parents: 4392
diff changeset
  4640
    "Modified: / 20.10.1996 / 13:06:38 / cg"
3d050f505a0a Raise proceedable signals proceedable.
Stefan Vogel <sv@exept.de>
parents: 4392
diff changeset
  4641
    "Modified: / 26.7.1999 / 10:58:49 / stefan"
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  4642
! !
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  4643
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  4644
!Object methodsFor:'message sending'!
a27a279701f8 Initial revision
claus
parents:
diff changeset
  4645
a27a279701f8 Initial revision
claus
parents:
diff changeset
  4646
perform:aSelector
a27a279701f8 Initial revision
claus
parents:
diff changeset
  4647
    "send the message aSelector to the receiver"
a27a279701f8 Initial revision
claus
parents:
diff changeset
  4648
1533
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  4649
%{
3317
8c0d47236f4b now keep 5 inlineCaches in #perform: and #performWith:
Claus Gittinger <cg@exept.de>
parents: 3309
diff changeset
  4650
    REGISTER OBJ sel = aSelector;
1533
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  4651
3306
66c9ab533baa care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  4652
    if (InterruptPending == nil) {
5495
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  4653
        struct inlineCache *pIlc;
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  4654
        static struct inlineCache ilc_0 = __ILCPERF0(@line);
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  4655
        static struct inlineCache ilc_1 = __ILCPERF0(@line);
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  4656
        static struct inlineCache ilc_2 = __ILCPERF0(@line);
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  4657
        static struct inlineCache ilc_3 = __ILCPERF0(@line);
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  4658
        static struct inlineCache ilc_4 = __ILCPERF0(@line);
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  4659
        static OBJ last_0 = nil;
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  4660
        static OBJ last_1 = nil;
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  4661
        static OBJ last_2 = nil;
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  4662
        static OBJ last_3 = nil;
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  4663
        static OBJ last_4 = nil;
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  4664
        static flip = 0;
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  4665
4090
ada783cc6b37 line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents: 4053
diff changeset
  4666
        if (sel == last_0) {
ada783cc6b37 line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents: 4053
diff changeset
  4667
            pIlc = &ilc_0;
5495
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  4668
        } else if (sel == last_1) {
4090
ada783cc6b37 line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents: 4053
diff changeset
  4669
            pIlc = &ilc_1;
5495
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  4670
        } else if (sel == last_2) {
4090
ada783cc6b37 line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents: 4053
diff changeset
  4671
            pIlc = &ilc_2;
5495
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  4672
        } else if (sel == last_3) {
4090
ada783cc6b37 line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents: 4053
diff changeset
  4673
            pIlc = &ilc_3;
5495
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  4674
        } else if (sel == last_4) {
4090
ada783cc6b37 line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents: 4053
diff changeset
  4675
            pIlc = &ilc_4;
5495
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  4676
        } else {
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  4677
            if (flip == 0) {
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  4678
                pIlc = &ilc_0;
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  4679
                flip = 1;
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  4680
                last_0 = sel;
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  4681
            } else if (flip == 1) {
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  4682
                pIlc = &ilc_1;
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  4683
                flip = 2;
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  4684
                last_1 = sel;
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  4685
            } else if (flip == 2) {
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  4686
                pIlc = &ilc_2;
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  4687
                flip = 3;
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  4688
                last_2 = sel;
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  4689
            } else if (flip == 3) {
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  4690
                pIlc = &ilc_3;
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  4691
                flip = 4;
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  4692
                last_3 = sel;
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  4693
            } else {
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  4694
                pIlc = &ilc_4;
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  4695
                flip = 0;
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  4696
                last_4 = sel;
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  4697
            }
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  4698
            pIlc->ilc_func = __SEND0ADDR__;
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  4699
            if (pIlc->ilc_poly) {
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  4700
                __flushPolyCache(pIlc->ilc_poly);
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  4701
                pIlc->ilc_poly = 0;
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  4702
            }
4090
ada783cc6b37 line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents: 4053
diff changeset
  4703
        }
ada783cc6b37 line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents: 4053
diff changeset
  4704
        RETURN ( (*(pIlc->ilc_func))(self, sel, nil, pIlc) );
1533
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  4705
    } else {
4090
ada783cc6b37 line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents: 4053
diff changeset
  4706
        static struct inlineCache ilc0 = __DUMMYILCSELF0(@line+1);
ada783cc6b37 line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents: 4053
diff changeset
  4707
        RETURN (_SEND0(self, aSelector, nil, &ilc0));
1085
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  4708
    }
5421
6dda4984b524 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5418
diff changeset
  4709
%}.
6dda4984b524 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5418
diff changeset
  4710
    ^ self perform:aSelector withArguments:#()
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  4711
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
  4712
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4713
perform:aSelector inClass:aClass withArguments:argArray
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4714
    "send the message aSelector with all args taken from argArray 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4715
     to the receiver as a super-send message.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4716
     This is actually more flexible than the normal super-send, since it allows
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4717
     to execute a method in ANY superclass of the receiver (not just the
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4718
     immediate superclass).
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4719
     Thus, it is (theoretically) possible to do 
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4720
         '5 perform:#< inClass:Magnitude withArguments:#(6)'
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4721
     and evaluate Magnitudes compare method even if there was one in Number.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4722
     This method is used by the interpreter to evaluate super sends
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4723
     and could be used for very special behavior (language extension ?).
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4724
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4725
     WARNING: this is an ST/X feature - probably not found in other smalltalks."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4726
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4727
    |numberOfArgs a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 a14 a15|
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4728
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4729
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4730
     check, if aClass is really a superclass of the receiver
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4731
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4732
    (self class isSubclassOf:aClass) ifFalse:[
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4733
        self error:'class argument is not a superclass of the receiver'.
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4734
        ^ nil
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4735
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4736
%{
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4737
    REGISTER OBJ *argP;
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4738
    int nargs, i;
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4739
2895
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  4740
    if (__isArray(argArray)) {
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4741
        nargs = __arraySize(argArray);
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4742
        argP = __ArrayInstPtr(argArray)->a_element;
2895
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  4743
    } else {
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4744
        if (__isNonNilObject(argArray)) {
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4745
            static struct inlineCache ilcSize = __ILC0(@line+1);
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4746
            numberOfArgs = (*ilcSize.ilc_func)(argArray, @symbol(size), nil, &ilcSize); 
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4747
            if (!__isSmallInteger(numberOfArgs)) 
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4748
                goto bad;
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4749
            nargs = __intVal(numberOfArgs);
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4750
            argP = (OBJ *)(&a1);
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4751
            for (i=1; i <= nargs; i++) {
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4752
                *argP++ = __AT_(argArray, __MKSMALLINT(i));
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4753
            }
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4754
            argP = (OBJ *)(&a1);
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4755
        } else {
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4756
            nargs = 0;
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4757
        }
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4758
    }
2895
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  4759
    switch (nargs) {
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4760
        case 0:
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4761
            {
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4762
                static struct inlineCache ilc0 = __DUMMYILCSELF0(@line+1);
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4763
                RETURN ( _SEND0(self, aSelector, aClass, &ilc0));
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4764
            }
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4765
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4766
        case 1: 
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4767
            {
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4768
                static struct inlineCache ilc1 = __DUMMYILCSELF1(@line+1);
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4769
                RETURN ( _SEND1(self, aSelector, aClass, &ilc1, argP[0]));
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4770
            }
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4771
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4772
        case 2: 
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4773
            {
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4774
                static struct inlineCache ilc2 = __DUMMYILCSELF2(@line+1);
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4775
                RETURN ( _SEND2(self, aSelector, aClass, &ilc2, argP[0], argP[1]));
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4776
            }
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4777
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4778
        case 3: 
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4779
            {
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4780
                static struct inlineCache ilc3 = __DUMMYILCSELF3(@line+1);
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4781
                RETURN ( _SEND3(self, aSelector, aClass, &ilc3, 
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4782
                                argP[0], argP[1], argP[2]));
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4783
            }
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4784
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4785
        case 4: 
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4786
            {
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4787
                static struct inlineCache ilc4 = __DUMMYILCSELF4(@line+1);
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4788
                RETURN ( _SEND4(self, aSelector, aClass, &ilc4,
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4789
                                argP[0], argP[1], argP[2], argP[3]));
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4790
            }
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4791
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4792
        case 5: 
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4793
            {
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4794
                static struct inlineCache ilc5 = __DUMMYILCSELF5(@line+1);
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4795
                RETURN ( _SEND5(self, aSelector, aClass, &ilc5, 
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4796
                                argP[0], argP[1], argP[2], argP[3], argP[4]));
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4797
            }
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4798
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4799
        case 6: 
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4800
            {
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4801
                static struct inlineCache ilc6 = __DUMMYILCSELF6(@line+1);
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4802
                RETURN ( _SEND6(self, aSelector, aClass, &ilc6, 
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4803
                                argP[0], argP[1], argP[2], argP[3], argP[4], argP[5]));
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4804
            }
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4805
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4806
        case 7: 
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4807
            {
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4808
                static struct inlineCache ilc7 = __DUMMYILCSELF7(@line+1);
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4809
                RETURN ( _SEND7(self, aSelector, aClass, &ilc7, 
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4810
                                argP[0], argP[1], argP[2], argP[3], argP[4], argP[5], 
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4811
                                argP[6]));
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4812
            }
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4813
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4814
        case 8: 
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4815
            {
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4816
                static struct inlineCache ilc8 = __DUMMYILCSELF8(@line+1);
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4817
                RETURN ( _SEND8(self, aSelector, aClass, &ilc8, 
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4818
                                argP[0], argP[1], argP[2], argP[3], argP[4], argP[5], 
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4819
                                argP[6], argP[7]));
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4820
            }
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4821
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4822
        case 9: 
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4823
            {
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4824
                static struct inlineCache ilc9 = __DUMMYILCSELF9(@line+1);
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4825
                RETURN ( _SEND9(self, aSelector, aClass, &ilc9, 
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4826
                                argP[0], argP[1], argP[2], argP[3], argP[4], argP[5], 
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4827
                                argP[6], argP[7], argP[8]));
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4828
            }
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4829
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4830
        case 10: 
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4831
            {
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4832
                static struct inlineCache ilc10 = __DUMMYILCSELF10(@line+1);
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4833
                RETURN ( _SEND10(self, aSelector, aClass, &ilc10, 
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4834
                                 argP[0], argP[1], argP[2], argP[3], argP[4], argP[5], 
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4835
                                 argP[6], argP[7], argP[8], argP[9]));
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4836
            }
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4837
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4838
        case 11: 
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4839
            {
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4840
                static struct inlineCache ilc11 = __DUMMYILCSELF11(@line+1);
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4841
                RETURN ( _SEND11(self, aSelector, aClass, &ilc11, 
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4842
                                 argP[0], argP[1], argP[2], argP[3], argP[4], argP[5], 
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4843
                                 argP[6], argP[7], argP[8], argP[9], argP[10]));
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4844
            }
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4845
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4846
        case 12: 
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4847
            {
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4848
                static struct inlineCache ilc12 = __DUMMYILCSELF12(@line+1);
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4849
                RETURN ( _SEND12(self, aSelector, aClass, &ilc12, 
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4850
                                 argP[0], argP[1], argP[2], argP[3], argP[4], argP[5], 
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4851
                                 argP[6], argP[7], argP[8], argP[9], argP[10], 
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4852
                                 argP[11]));
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4853
            }
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4854
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4855
        case 13: 
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4856
            {
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4857
                static struct inlineCache ilc13 = __DUMMYILCSELF13(@line+1);
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4858
                RETURN ( _SEND13(self, aSelector, aClass, &ilc13, 
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4859
                                 argP[0], argP[1], argP[2], argP[3], argP[4], argP[5], 
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4860
                                 argP[6], argP[7], argP[8], argP[9], argP[10], 
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4861
                                 argP[11], argP[12]));
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4862
            }
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4863
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4864
        case 14: 
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4865
            {
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4866
                static struct inlineCache ilc14 = __DUMMYILCSELF14(@line+1);
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4867
                RETURN ( _SEND14(self, aSelector, aClass, &ilc14, 
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4868
                                 argP[0], argP[1], argP[2], argP[3], argP[4], argP[5], 
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4869
                                 argP[6], argP[7], argP[8], argP[9], argP[10], 
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4870
                                 argP[11], argP[12], argP[13]));
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4871
            }
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4872
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4873
        case 15: 
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4874
            {
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4875
                static struct inlineCache ilc15 = __DUMMYILCSELF15(@line+1);
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4876
                RETURN ( _SEND15(self, aSelector, aClass, &ilc15, 
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4877
                                 argP[0], argP[1], argP[2], argP[3], argP[4], argP[5], 
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4878
                                 argP[6], argP[7], argP[8], argP[9], argP[10], 
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4879
                                 argP[11], argP[12], argP[13], argP[14]));
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4880
            }
3306
66c9ab533baa care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  4881
66c9ab533baa care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  4882
#ifdef _SEND16
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4883
        case 16:
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4884
            {
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4885
                static struct inlineCache ilc16 = __DUMMYILCSELF16(@line+1);
5495
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  4886
                RETURN ( _SEND16(self, aSelector, aClass, &ilc15,
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4887
                                 argP[0], argP[1], argP[2], argP[3], argP[4], argP[5],
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4888
                                 argP[6], argP[7], argP[8], argP[9], argP[10],
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4889
                                 argP[11], argP[12], argP[13], argP[14], argP[15]));
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  4890
            }
3306
66c9ab533baa care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  4891
#endif
5495
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  4892
#ifdef _SEND17
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  4893
        case 17:
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  4894
            {
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  4895
                static struct inlineCache ilc17 = __DUMMYILCSELF17(@line+1);
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  4896
                RETURN ( _SEND17(self, aSelector, aClass, &ilc15,
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  4897
                                 argP[0], argP[1], argP[2], argP[3], argP[4], argP[5],
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  4898
                                 argP[6], argP[7], argP[8], argP[9], argP[10],
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  4899
                                 argP[11], argP[12], argP[13], argP[14], argP[15], argP[16]));
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  4900
            }
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  4901
#endif
3306
66c9ab533baa care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  4902
66c9ab533baa care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  4903
2895
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  4904
    }
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  4905
bad:;
1626
b3b69b572627 comments
Claus Gittinger <cg@exept.de>
parents: 1624
diff changeset
  4906
%}.
b3b69b572627 comments
Claus Gittinger <cg@exept.de>
parents: 1624
diff changeset
  4907
    "/ arrive here, if bad number of arguments (too many)
b3b69b572627 comments
Claus Gittinger <cg@exept.de>
parents: 1624
diff changeset
  4908
    "/ ST/X (currently) only allows up to 15 method arguments
b3b69b572627 comments
Claus Gittinger <cg@exept.de>
parents: 1624
diff changeset
  4909
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4910
    ^ self primitiveFailed
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4911
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4912
3317
8c0d47236f4b now keep 5 inlineCaches in #perform: and #performWith:
Claus Gittinger <cg@exept.de>
parents: 3309
diff changeset
  4913
perform:aSelector with:arg
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  4914
    "send the one-arg-message aSelector to the receiver"
a27a279701f8 Initial revision
claus
parents:
diff changeset
  4915
1533
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  4916
%{
3317
8c0d47236f4b now keep 5 inlineCaches in #perform: and #performWith:
Claus Gittinger <cg@exept.de>
parents: 3309
diff changeset
  4917
    REGISTER OBJ sel = aSelector;
1533
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  4918
3306
66c9ab533baa care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  4919
    if (InterruptPending == nil) {
5495
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  4920
        struct inlineCache *pIlc;
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  4921
        static struct inlineCache ilc_0 = __ILCPERF1(@line);
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  4922
        static struct inlineCache ilc_1 = __ILCPERF1(@line);
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  4923
        static struct inlineCache ilc_2 = __ILCPERF1(@line);
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  4924
        static struct inlineCache ilc_3 = __ILCPERF1(@line);
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  4925
        static struct inlineCache ilc_4 = __ILCPERF1(@line);
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  4926
        static OBJ last_0 = nil;
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  4927
        static OBJ last_1 = nil;
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  4928
        static OBJ last_2 = nil;
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  4929
        static OBJ last_3 = nil;
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  4930
        static OBJ last_4 = nil;
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  4931
        static flip = 0;
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  4932
4090
ada783cc6b37 line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents: 4053
diff changeset
  4933
        if (sel == last_0) {
ada783cc6b37 line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents: 4053
diff changeset
  4934
            pIlc = &ilc_0;
5495
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  4935
        } else if (sel == last_1) {
4090
ada783cc6b37 line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents: 4053
diff changeset
  4936
            pIlc = &ilc_1;
5495
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  4937
        } else if (sel == last_2) {
4090
ada783cc6b37 line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents: 4053
diff changeset
  4938
            pIlc = &ilc_2;
5495
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  4939
        } else if (sel == last_3) {
4090
ada783cc6b37 line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents: 4053
diff changeset
  4940
            pIlc = &ilc_3;
5495
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  4941
        } else if (sel == last_4) {
4090
ada783cc6b37 line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents: 4053
diff changeset
  4942
            pIlc = &ilc_4;
5495
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  4943
        } else {
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  4944
            if (flip == 0) {
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  4945
                pIlc = &ilc_0;
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  4946
                flip = 1;
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  4947
                last_0 = sel;
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  4948
            } else if (flip == 1) {
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  4949
                pIlc = &ilc_1;
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  4950
                flip = 2;
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  4951
                last_1 = sel;
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  4952
            } else if (flip == 2) {
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  4953
                pIlc = &ilc_2;
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  4954
                flip = 3;
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  4955
                last_2 = sel;
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  4956
            } else if (flip == 3) {
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  4957
                pIlc = &ilc_3;
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  4958
                flip = 4;
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  4959
                last_3 = sel;
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  4960
            } else {
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  4961
                pIlc = &ilc_4;
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  4962
                flip = 0;
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  4963
                last_4 = sel;
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  4964
            }
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  4965
            pIlc->ilc_func = __SEND1ADDR__;
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  4966
            if (pIlc->ilc_poly) {
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  4967
                __flushPolyCache(pIlc->ilc_poly);
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  4968
                pIlc->ilc_poly = 0;
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  4969
            }
4090
ada783cc6b37 line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents: 4053
diff changeset
  4970
        }
ada783cc6b37 line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents: 4053
diff changeset
  4971
        RETURN ( (*(pIlc->ilc_func))(self, sel, nil, pIlc, arg) );
1533
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  4972
    } else {
4090
ada783cc6b37 line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents: 4053
diff changeset
  4973
        static struct inlineCache ilc1 = __DUMMYILCSELF1(@line+1);
ada783cc6b37 line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents: 4053
diff changeset
  4974
        RETURN (_SEND1(self, aSelector, nil, &ilc1, arg));
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  4975
    }
5421
6dda4984b524 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5418
diff changeset
  4976
%}.
6dda4984b524 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5418
diff changeset
  4977
    ^ self perform:aSelector withArguments:(Array with:arg)
1533
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  4978
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  4979
!
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  4980
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  4981
perform:aSelector with:arg1 with:arg2
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  4982
    "send the two-arg-message aSelector to the receiver"
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  4983
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  4984
%{
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  4985
    struct inlineCache *pIlc;
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  4986
3306
66c9ab533baa care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  4987
    if (InterruptPending == nil) {
5495
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  4988
        static struct inlineCache ilc_0 = __ILCPERF2(@line);
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  4989
        static struct inlineCache ilc_1 = __ILCPERF2(@line);
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  4990
        static OBJ last_0 = nil;
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  4991
        static OBJ last_1 = nil;
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  4992
        static flip = 0;
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  4993
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  4994
        if (aSelector == last_0) {
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  4995
            pIlc = &ilc_0;
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  4996
        } else if (aSelector == last_1) {
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  4997
            pIlc = &ilc_1;
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  4998
        } else {
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  4999
            if (flip == 0) {
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5000
                pIlc = &ilc_0;
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5001
                flip = 1;
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5002
                last_0 = aSelector;
4090
ada783cc6b37 line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents: 4053
diff changeset
  5003
            } else {
ada783cc6b37 line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents: 4053
diff changeset
  5004
                pIlc = &ilc_1;
5495
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5005
                flip = 0;
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5006
                last_1 = aSelector;
4090
ada783cc6b37 line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents: 4053
diff changeset
  5007
            }
5495
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5008
            pIlc->ilc_func = __SEND2ADDR__;
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5009
            if (pIlc->ilc_poly) {
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5010
                __flushPolyCache(pIlc->ilc_poly);
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5011
                pIlc->ilc_poly = 0;
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5012
            }
4090
ada783cc6b37 line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents: 4053
diff changeset
  5013
        }
ada783cc6b37 line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents: 4053
diff changeset
  5014
        RETURN ( (*(pIlc->ilc_func))(self, aSelector, nil, pIlc, arg1, arg2) );
1533
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  5015
    } else {
4090
ada783cc6b37 line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents: 4053
diff changeset
  5016
        static struct inlineCache ilc2 = __DUMMYILCSELF2(@line+1);
ada783cc6b37 line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents: 4053
diff changeset
  5017
        RETURN (_SEND2(self, aSelector, nil, &ilc2, arg1, arg2));
1533
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  5018
    }
5421
6dda4984b524 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5418
diff changeset
  5019
%}.
6dda4984b524 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5418
diff changeset
  5020
    ^ self perform:aSelector withArguments:(Array with:arg1 with:arg2)
1533
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  5021
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  5022
!
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  5023
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  5024
perform:aSelector with:arg1 with:arg2 with:arg3
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  5025
    "send the three-arg-message aSelector to the receiver"
a27a279701f8 Initial revision
claus
parents:
diff changeset
  5026
1533
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  5027
%{
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  5028
    struct inlineCache *pIlc;
5495
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5029
    static struct inlineCache ilc_0 = __ILCPERF3(@line);
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5030
    static struct inlineCache ilc_1 = __ILCPERF3(@line);
1533
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  5031
    static OBJ last_0 = nil;
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  5032
    static OBJ last_1 = nil;
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  5033
    static flip = 0;
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  5034
3306
66c9ab533baa care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  5035
    if (InterruptPending == nil) {
4090
ada783cc6b37 line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents: 4053
diff changeset
  5036
        if (aSelector != last_0) {
ada783cc6b37 line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents: 4053
diff changeset
  5037
            if (aSelector != last_1) {
ada783cc6b37 line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents: 4053
diff changeset
  5038
                if (flip) {
ada783cc6b37 line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents: 4053
diff changeset
  5039
                    pIlc = &ilc_0;
ada783cc6b37 line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents: 4053
diff changeset
  5040
                    flip = 0;
ada783cc6b37 line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents: 4053
diff changeset
  5041
                    last_0 = aSelector;
ada783cc6b37 line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents: 4053
diff changeset
  5042
                } else {
ada783cc6b37 line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents: 4053
diff changeset
  5043
                    pIlc = &ilc_1;
ada783cc6b37 line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents: 4053
diff changeset
  5044
                    flip = 1;
ada783cc6b37 line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents: 4053
diff changeset
  5045
                    last_1 = aSelector;
ada783cc6b37 line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents: 4053
diff changeset
  5046
                }
ada783cc6b37 line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents: 4053
diff changeset
  5047
                pIlc->ilc_func = __SEND3ADDR__;
ada783cc6b37 line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents: 4053
diff changeset
  5048
                if (pIlc->ilc_poly) {
ada783cc6b37 line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents: 4053
diff changeset
  5049
                    __flushPolyCache(pIlc->ilc_poly);
ada783cc6b37 line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents: 4053
diff changeset
  5050
                    pIlc->ilc_poly = 0;
ada783cc6b37 line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents: 4053
diff changeset
  5051
                }
ada783cc6b37 line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents: 4053
diff changeset
  5052
            } else {
ada783cc6b37 line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents: 4053
diff changeset
  5053
                pIlc = &ilc_1;
ada783cc6b37 line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents: 4053
diff changeset
  5054
            }
ada783cc6b37 line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents: 4053
diff changeset
  5055
        } else {
ada783cc6b37 line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents: 4053
diff changeset
  5056
            pIlc = &ilc_0;
ada783cc6b37 line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents: 4053
diff changeset
  5057
        }
5495
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5058
        RETURN ( (*(pIlc->ilc_func))(self, aSelector, nil, pIlc, arg1, arg2, arg3) );
1533
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  5059
    } else {
4090
ada783cc6b37 line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents: 4053
diff changeset
  5060
        static struct inlineCache ilc3 = __DUMMYILCSELF3(@line+1);
ada783cc6b37 line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents: 4053
diff changeset
  5061
        RETURN (_SEND3(self, aSelector, nil, &ilc3, arg1, arg2, arg3));
1085
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  5062
    }
5421
6dda4984b524 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5418
diff changeset
  5063
%}.
6dda4984b524 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5418
diff changeset
  5064
    ^ self perform:aSelector withArguments:(Array with:arg1 with:arg2 with:arg3)
6dda4984b524 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5418
diff changeset
  5065
2437
63905fb8d89e added perform with 4 args
Claus Gittinger <cg@exept.de>
parents: 2412
diff changeset
  5066
!
63905fb8d89e added perform with 4 args
Claus Gittinger <cg@exept.de>
parents: 2412
diff changeset
  5067
63905fb8d89e added perform with 4 args
Claus Gittinger <cg@exept.de>
parents: 2412
diff changeset
  5068
perform:aSelector with:arg1 with:arg2 with:arg3 with:arg4
63905fb8d89e added perform with 4 args
Claus Gittinger <cg@exept.de>
parents: 2412
diff changeset
  5069
    "send the four-arg-message aSelector to the receiver"
63905fb8d89e added perform with 4 args
Claus Gittinger <cg@exept.de>
parents: 2412
diff changeset
  5070
63905fb8d89e added perform with 4 args
Claus Gittinger <cg@exept.de>
parents: 2412
diff changeset
  5071
%{
63905fb8d89e added perform with 4 args
Claus Gittinger <cg@exept.de>
parents: 2412
diff changeset
  5072
    struct inlineCache *pIlc;
5495
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5073
    static struct inlineCache ilc_0 = __ILCPERF4(@line);
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5074
    static struct inlineCache ilc_1 = __ILCPERF4(@line);
2437
63905fb8d89e added perform with 4 args
Claus Gittinger <cg@exept.de>
parents: 2412
diff changeset
  5075
    static OBJ last_0 = nil;
63905fb8d89e added perform with 4 args
Claus Gittinger <cg@exept.de>
parents: 2412
diff changeset
  5076
    static OBJ last_1 = nil;
63905fb8d89e added perform with 4 args
Claus Gittinger <cg@exept.de>
parents: 2412
diff changeset
  5077
    static flip = 0;
63905fb8d89e added perform with 4 args
Claus Gittinger <cg@exept.de>
parents: 2412
diff changeset
  5078
3306
66c9ab533baa care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  5079
    if (InterruptPending == nil) {
4090
ada783cc6b37 line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents: 4053
diff changeset
  5080
        if (aSelector != last_0) {
ada783cc6b37 line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents: 4053
diff changeset
  5081
            if (aSelector != last_1) {
ada783cc6b37 line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents: 4053
diff changeset
  5082
                if (flip) {
ada783cc6b37 line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents: 4053
diff changeset
  5083
                    pIlc = &ilc_0;
ada783cc6b37 line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents: 4053
diff changeset
  5084
                    flip = 0;
ada783cc6b37 line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents: 4053
diff changeset
  5085
                    last_0 = aSelector;
ada783cc6b37 line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents: 4053
diff changeset
  5086
                } else {
ada783cc6b37 line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents: 4053
diff changeset
  5087
                    pIlc = &ilc_1;
ada783cc6b37 line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents: 4053
diff changeset
  5088
                    flip = 1;
ada783cc6b37 line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents: 4053
diff changeset
  5089
                    last_1 = aSelector;
ada783cc6b37 line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents: 4053
diff changeset
  5090
                }
ada783cc6b37 line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents: 4053
diff changeset
  5091
                pIlc->ilc_func = __SEND4ADDR__;
ada783cc6b37 line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents: 4053
diff changeset
  5092
                if (pIlc->ilc_poly) {
ada783cc6b37 line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents: 4053
diff changeset
  5093
                    __flushPolyCache(pIlc->ilc_poly);
ada783cc6b37 line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents: 4053
diff changeset
  5094
                    pIlc->ilc_poly = 0;
ada783cc6b37 line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents: 4053
diff changeset
  5095
                }
ada783cc6b37 line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents: 4053
diff changeset
  5096
            } else {
ada783cc6b37 line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents: 4053
diff changeset
  5097
                pIlc = &ilc_1;
ada783cc6b37 line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents: 4053
diff changeset
  5098
            }
ada783cc6b37 line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents: 4053
diff changeset
  5099
        } else {
ada783cc6b37 line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents: 4053
diff changeset
  5100
            pIlc = &ilc_0;
ada783cc6b37 line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents: 4053
diff changeset
  5101
        }
ada783cc6b37 line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents: 4053
diff changeset
  5102
        RETURN ( (*(pIlc->ilc_func))(self, aSelector, nil, pIlc, 
ada783cc6b37 line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents: 4053
diff changeset
  5103
                                     arg1, arg2, arg3, arg4) );
2437
63905fb8d89e added perform with 4 args
Claus Gittinger <cg@exept.de>
parents: 2412
diff changeset
  5104
    } else {
4090
ada783cc6b37 line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents: 4053
diff changeset
  5105
        static struct inlineCache ilc4 = __DUMMYILCSELF4(@line+1);
ada783cc6b37 line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents: 4053
diff changeset
  5106
        RETURN (_SEND4(self, aSelector, nil, &ilc4,
ada783cc6b37 line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents: 4053
diff changeset
  5107
                       arg1, arg2, arg3, arg4));
2437
63905fb8d89e added perform with 4 args
Claus Gittinger <cg@exept.de>
parents: 2412
diff changeset
  5108
    }
5421
6dda4984b524 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5418
diff changeset
  5109
%}.
6dda4984b524 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5418
diff changeset
  5110
    ^ self perform:aSelector withArguments:(Array with:arg1 with:arg2 with:arg3 with:arg4)
6dda4984b524 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5418
diff changeset
  5111
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  5112
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
  5113
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  5114
perform:aSelector with:arg1 with:arg2 with:arg3 with:arg4 with:arg5
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  5115
    "send the five-arg-message aSelector to the receiver"
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  5116
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  5117
%{
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  5118
    struct inlineCache *pIlc;
5495
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5119
    static struct inlineCache ilc_0 = __ILCPERF5(@line);
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5120
    static struct inlineCache ilc_1 = __ILCPERF5(@line);
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  5121
    static OBJ last_0 = nil;
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  5122
    static OBJ last_1 = nil;
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  5123
    static flip = 0;
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  5124
3306
66c9ab533baa care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  5125
    if (InterruptPending == nil) {
4090
ada783cc6b37 line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents: 4053
diff changeset
  5126
        if (aSelector != last_0) {
ada783cc6b37 line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents: 4053
diff changeset
  5127
            if (aSelector != last_1) {
ada783cc6b37 line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents: 4053
diff changeset
  5128
                if (flip) {
ada783cc6b37 line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents: 4053
diff changeset
  5129
                    pIlc = &ilc_0;
ada783cc6b37 line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents: 4053
diff changeset
  5130
                    flip = 0;
ada783cc6b37 line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents: 4053
diff changeset
  5131
                    last_0 = aSelector;
ada783cc6b37 line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents: 4053
diff changeset
  5132
                } else {
ada783cc6b37 line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents: 4053
diff changeset
  5133
                    pIlc = &ilc_1;
ada783cc6b37 line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents: 4053
diff changeset
  5134
                    flip = 1;
ada783cc6b37 line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents: 4053
diff changeset
  5135
                    last_1 = aSelector;
ada783cc6b37 line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents: 4053
diff changeset
  5136
                }
ada783cc6b37 line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents: 4053
diff changeset
  5137
                pIlc->ilc_func = __SEND5ADDR__;
ada783cc6b37 line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents: 4053
diff changeset
  5138
                if (pIlc->ilc_poly) {
ada783cc6b37 line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents: 4053
diff changeset
  5139
                    __flushPolyCache(pIlc->ilc_poly);
ada783cc6b37 line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents: 4053
diff changeset
  5140
                    pIlc->ilc_poly = 0;
ada783cc6b37 line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents: 4053
diff changeset
  5141
                }
ada783cc6b37 line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents: 4053
diff changeset
  5142
            } else {
ada783cc6b37 line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents: 4053
diff changeset
  5143
                pIlc = &ilc_1;
ada783cc6b37 line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents: 4053
diff changeset
  5144
            }
ada783cc6b37 line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents: 4053
diff changeset
  5145
        } else {
ada783cc6b37 line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents: 4053
diff changeset
  5146
            pIlc = &ilc_0;
ada783cc6b37 line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents: 4053
diff changeset
  5147
        }
ada783cc6b37 line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents: 4053
diff changeset
  5148
        RETURN ( (*(pIlc->ilc_func))(self, aSelector, nil, pIlc, 
ada783cc6b37 line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents: 4053
diff changeset
  5149
                                     arg1, arg2, arg3, arg4, arg5) );
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  5150
    } else {
4090
ada783cc6b37 line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents: 4053
diff changeset
  5151
        static struct inlineCache ilc5 = __DUMMYILCSELF5(@line+1);
ada783cc6b37 line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents: 4053
diff changeset
  5152
        RETURN (_SEND5(self, aSelector, nil, &ilc5,
ada783cc6b37 line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents: 4053
diff changeset
  5153
                       arg1, arg2, arg3, arg4, arg5));
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  5154
    }
5421
6dda4984b524 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5418
diff changeset
  5155
%}.
6dda4984b524 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5418
diff changeset
  5156
    ^ self perform:aSelector withArguments:(Array with:arg1 with:arg2 with:arg3 with:arg4
6dda4984b524 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5418
diff changeset
  5157
                                                  with:arg5)
6dda4984b524 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5418
diff changeset
  5158
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  5159
!
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  5160
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  5161
perform:aSelector with:arg1 with:arg2 with:arg3 with:arg4 with:arg5 with:arg6
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  5162
    "send the six-arg-message aSelector to the receiver"
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  5163
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  5164
%{
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  5165
    struct inlineCache *pIlc;
5495
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5166
    static struct inlineCache ilc_0 = __ILCPERF6(@line);
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5167
    static struct inlineCache ilc_1 = __ILCPERF6(@line);
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  5168
    static OBJ last_0 = nil;
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  5169
    static OBJ last_1 = nil;
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  5170
    static flip = 0;
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  5171
3306
66c9ab533baa care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  5172
    if (InterruptPending == nil) {
4090
ada783cc6b37 line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents: 4053
diff changeset
  5173
        if (aSelector != last_0) {
ada783cc6b37 line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents: 4053
diff changeset
  5174
            if (aSelector != last_1) {
ada783cc6b37 line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents: 4053
diff changeset
  5175
                if (flip) {
ada783cc6b37 line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents: 4053
diff changeset
  5176
                    pIlc = &ilc_0;
ada783cc6b37 line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents: 4053
diff changeset
  5177
                    flip = 0;
ada783cc6b37 line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents: 4053
diff changeset
  5178
                    last_0 = aSelector;
ada783cc6b37 line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents: 4053
diff changeset
  5179
                } else {
ada783cc6b37 line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents: 4053
diff changeset
  5180
                    pIlc = &ilc_1;
ada783cc6b37 line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents: 4053
diff changeset
  5181
                    flip = 1;
ada783cc6b37 line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents: 4053
diff changeset
  5182
                    last_1 = aSelector;
ada783cc6b37 line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents: 4053
diff changeset
  5183
                }
ada783cc6b37 line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents: 4053
diff changeset
  5184
                pIlc->ilc_func = __SEND6ADDR__;
ada783cc6b37 line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents: 4053
diff changeset
  5185
                if (pIlc->ilc_poly) {
ada783cc6b37 line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents: 4053
diff changeset
  5186
                    __flushPolyCache(pIlc->ilc_poly);
ada783cc6b37 line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents: 4053
diff changeset
  5187
                    pIlc->ilc_poly = 0;
ada783cc6b37 line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents: 4053
diff changeset
  5188
                }
ada783cc6b37 line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents: 4053
diff changeset
  5189
            } else {
ada783cc6b37 line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents: 4053
diff changeset
  5190
                pIlc = &ilc_1;
ada783cc6b37 line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents: 4053
diff changeset
  5191
            }
ada783cc6b37 line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents: 4053
diff changeset
  5192
        } else {
ada783cc6b37 line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents: 4053
diff changeset
  5193
            pIlc = &ilc_0;
ada783cc6b37 line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents: 4053
diff changeset
  5194
        }
ada783cc6b37 line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents: 4053
diff changeset
  5195
ada783cc6b37 line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents: 4053
diff changeset
  5196
        RETURN ( (*(pIlc->ilc_func))(self, aSelector, nil, pIlc, 
ada783cc6b37 line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents: 4053
diff changeset
  5197
                                     arg1, arg2, arg3, arg4, arg5, arg6) );
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  5198
    } else {
4090
ada783cc6b37 line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents: 4053
diff changeset
  5199
        static struct inlineCache ilc6 = __DUMMYILCSELF6(@line+1);
ada783cc6b37 line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents: 4053
diff changeset
  5200
        RETURN (_SEND6(self, aSelector, nil, &ilc6,
ada783cc6b37 line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents: 4053
diff changeset
  5201
                       arg1, arg2, arg3, arg4, arg5, arg6));
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  5202
    }
5421
6dda4984b524 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5418
diff changeset
  5203
%}.
6dda4984b524 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5418
diff changeset
  5204
    ^ self perform:aSelector withArguments:(Array with:arg1 with:arg2 with:arg3 with:arg4
6dda4984b524 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5418
diff changeset
  5205
                                                  with:arg5 with:arg6)
6dda4984b524 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5418
diff changeset
  5206
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  5207
!
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  5208
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  5209
perform:aSelector withArguments:argArray
a27a279701f8 Initial revision
claus
parents:
diff changeset
  5210
    "send the message aSelector with all args taken from argArray 
44
b262907c93ea *** empty log message ***
claus
parents: 39
diff changeset
  5211
     to the receiver."
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  5212
77
6c38ca59927f *** empty log message ***
claus
parents: 71
diff changeset
  5213
    |numberOfArgs a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 a14 a15|
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  5214
a27a279701f8 Initial revision
claus
parents:
diff changeset
  5215
%{
a27a279701f8 Initial revision
claus
parents:
diff changeset
  5216
    REGISTER OBJ *argP;
5495
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5217
    int nargs;
1085
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  5218
    OBJ l;
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  5219
2895
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  5220
    if (__isArray(argArray)) {
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  5221
        nargs = __arraySize(argArray);
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  5222
        argP = __ArrayInstPtr(argArray)->a_element;
2895
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  5223
    } else {
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  5224
        if (__isNonNilObject(argArray)) {
5495
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5225
            static struct inlineCache ilcSize = __ILC0(@line);
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5226
            int i;
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5227
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  5228
            numberOfArgs = (*ilcSize.ilc_func)(argArray, @symbol(size), nil, &ilcSize); 
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  5229
            if (!__isSmallInteger(numberOfArgs)) 
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  5230
                goto bad;
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  5231
            nargs = __intVal(numberOfArgs);
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  5232
            argP = (OBJ *)(&a1);
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  5233
            for (i=1; i <= nargs; i++) {
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  5234
                *argP++ = __AT_(argArray, __MKSMALLINT(i));
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  5235
            }
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  5236
            argP = (OBJ *)(&a1);
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  5237
        } else {
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  5238
            nargs = 0;
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  5239
        }
2895
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  5240
    }
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  5241
    switch (nargs) {
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  5242
        case 0:
5495
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5243
            if (InterruptPending == nil) {
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5244
                static OBJ last0_0 = nil; static struct inlineCache ilc0_0 = __ILCPERF0(@line);
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5245
                static OBJ last0_1 = nil; static struct inlineCache ilc0_1 = __ILCPERF0(@line);
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5246
                static OBJ last0_2 = nil; static struct inlineCache ilc0_2 = __ILCPERF0(@line);
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5247
                static OBJ last0_3 = nil; static struct inlineCache ilc0_3 = __ILCPERF0(@line);
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5248
                static int flip0 = 0;
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5249
                struct inlineCache *pIlc;
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5250
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5251
                if (aSelector == last0_0) {
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5252
                    pIlc = &ilc0_0;
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5253
                } else if (aSelector == last0_1) {
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5254
                    pIlc = &ilc0_1;
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5255
                } else if (aSelector == last0_2) {
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5256
                    pIlc = &ilc0_2;
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5257
                } else if (aSelector == last0_3) {
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5258
                    pIlc = &ilc0_3;
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5259
                } else {
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5260
                    if (flip0 == 0) {
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5261
                        pIlc = &ilc0_0;
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5262
                        flip0 = 1;
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5263
                        last0_0 = aSelector;
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5264
                    } else if (flip0 == 1) {
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5265
                        pIlc = &ilc0_1;
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5266
                        flip0 = 2;
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5267
                        last0_1 = aSelector;
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5268
                    } else if (flip0 == 2) {
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5269
                        pIlc = &ilc0_2;
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5270
                        flip0 = 3;
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5271
                        last0_2 = aSelector;
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5272
                    } else {
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5273
                        pIlc = &ilc0_3;
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5274
                        flip0 = 0;
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5275
                        last0_3 = aSelector;
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5276
                    }
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5277
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5278
                    pIlc->ilc_func = __SEND0ADDR__;
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5279
                    if (pIlc->ilc_poly) {
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5280
                        __flushPolyCache(pIlc->ilc_poly);
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5281
                        pIlc->ilc_poly = 0;
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5282
                    }
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  5283
                }
5495
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5284
                RETURN ((*pIlc->ilc_func)(self, aSelector, nil, pIlc));
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5285
            } else {
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5286
                static struct inlineCache ilc0 = __DUMMYILCSELF0(@line+1);
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5287
                RETURN (_SEND0(self, aSelector, nil, &ilc0));
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  5288
            }
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  5289
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  5290
        case 1: 
5495
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5291
            if (InterruptPending == nil) {
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5292
                static OBJ last1_0 = nil; static struct inlineCache ilc1_0 = __ILCPERF1(@line);
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5293
                static OBJ last1_1 = nil; static struct inlineCache ilc1_1 = __ILCPERF1(@line);
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5294
                static OBJ last1_2 = nil; static struct inlineCache ilc1_2 = __ILCPERF1(@line);
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5295
                static OBJ last1_3 = nil; static struct inlineCache ilc1_3 = __ILCPERF1(@line);
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5296
                static int flip1 = 0;
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5297
                struct inlineCache *pIlc;
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5298
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5299
                if (aSelector == last1_0) {
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5300
                    pIlc = &ilc1_0;
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5301
                } else if (aSelector == last1_1) {
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5302
                    pIlc = &ilc1_1;
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5303
                } else if (aSelector == last1_2) {
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5304
                    pIlc = &ilc1_2;
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5305
                } else if (aSelector == last1_3) {
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5306
                    pIlc = &ilc1_3;
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5307
                } else {
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5308
                    if (flip1 == 0) {
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5309
                        pIlc = &ilc1_0;
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5310
                        flip1 = 1;
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5311
                        last1_0 = aSelector;
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5312
                    } else if (flip1 == 1) {
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5313
                        pIlc = &ilc1_1;
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5314
                        flip1 = 2;
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5315
                        last1_1 = aSelector;
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5316
                    } else if (flip1 == 2) {
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5317
                        pIlc = &ilc1_2;
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5318
                        flip1 = 3;
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5319
                        last1_2 = aSelector;
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5320
                    } else {
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5321
                        pIlc = &ilc1_3;
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5322
                        flip1 = 0;
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5323
                        last1_3 = aSelector;
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5324
                    }
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5325
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5326
                    pIlc->ilc_func = __SEND1ADDR__;
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5327
                    if (pIlc->ilc_poly) {
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5328
                        __flushPolyCache(pIlc->ilc_poly);
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5329
                        pIlc->ilc_poly = 0;
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5330
                    }
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  5331
                }
5495
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5332
                RETURN ((*pIlc->ilc_func)(self, aSelector, nil, pIlc, argP[0]));
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5333
            } else {
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5334
                static struct inlineCache ilc1 = __DUMMYILCSELF1(@line+1);
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5335
                RETURN (_SEND1(self, aSelector, nil, &ilc1, argP[0]));
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  5336
            }
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  5337
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  5338
        case 2: 
5495
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5339
            if (InterruptPending == nil) {
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5340
                static OBJ last2_0 = nil; static struct inlineCache ilc2_0 = __ILCPERF2(@line);
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5341
                static OBJ last2_1 = nil; static struct inlineCache ilc2_1 = __ILCPERF2(@line);
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5342
                static int flip2 = 0;
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5343
                struct inlineCache *pIlc;
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5344
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5345
                if (aSelector == last2_0) {
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5346
                    pIlc = &ilc2_0;
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5347
                } else if (aSelector == last2_1) {
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5348
                    pIlc = &ilc2_1;
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5349
                } else {
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5350
                    if (flip2 == 0) {
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5351
                        pIlc = &ilc2_0;
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5352
                        flip2 = 1;
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5353
                        last2_0 = aSelector;
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5354
                    } else {
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5355
                        pIlc = &ilc2_1;
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5356
                        flip2 = 0;
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5357
                        last2_1 = aSelector;
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5358
                    }
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5359
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5360
                    pIlc->ilc_func = __SEND2ADDR__;
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5361
                    if (pIlc->ilc_poly) {
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5362
                        __flushPolyCache(pIlc->ilc_poly);
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5363
                        pIlc->ilc_poly = 0;
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5364
                    }
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  5365
                }
5495
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5366
                RETURN ((*pIlc->ilc_func)(self, aSelector, nil, pIlc, argP[0], argP[1]));
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5367
            } else {
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5368
                static struct inlineCache ilc2 = __DUMMYILCSELF2(@line+1);
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5369
                RETURN (_SEND2(self, aSelector, nil, &ilc2, argP[0], argP[1]));
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  5370
            }
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  5371
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  5372
        case 3: 
5495
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5373
            if (InterruptPending == nil) {
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5374
                static OBJ last3_0 = nil; static struct inlineCache ilc3_0 = __ILCPERF3(@line);
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5375
                static OBJ last3_1 = nil; static struct inlineCache ilc3_1 = __ILCPERF3(@line);
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5376
                static int flip3 = 0;
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5377
                struct inlineCache *pIlc;
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5378
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5379
                if (aSelector == last3_0) {
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5380
                    pIlc = &ilc3_0;
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5381
                } else if (aSelector == last3_1) {
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5382
                    pIlc = &ilc3_1;
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5383
                } else {
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5384
                    if (flip3 == 0) {
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5385
                        pIlc = &ilc3_0;
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5386
                        flip3 = 1;
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5387
                        last3_0 = aSelector;
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5388
                    } else {
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5389
                        pIlc = &ilc3_1;
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5390
                        flip3 = 0;
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5391
                        last3_1 = aSelector;
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5392
                    }
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5393
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5394
                    pIlc->ilc_func = __SEND3ADDR__;
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5395
                    if (pIlc->ilc_poly) {
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5396
                        __flushPolyCache(pIlc->ilc_poly);
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5397
                        pIlc->ilc_poly = 0;
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5398
                    }
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  5399
                }
5495
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5400
                RETURN ((*pIlc->ilc_func)(self, aSelector, nil, pIlc, argP[0], argP[1], argP[2]));
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5401
            } else {
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5402
                static struct inlineCache ilc3 = __DUMMYILCSELF3(@line+1);
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5403
                RETURN (_SEND3(self, aSelector, nil, &ilc3, argP[0], argP[1], argP[2]));
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  5404
            }
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  5405
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  5406
        case 4: 
5495
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5407
            {
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5408
                static OBJ last4 = nil; static struct inlineCache ilc4 = __ILCPERF4(@line);
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5409
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5410
                if ((InterruptPending != nil) || (aSelector != last4)) {
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5411
                    ilc4.ilc_func = __SEND4ADDR__;
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5412
                    if (ilc4.ilc_poly) {
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5413
                        __flushPolyCache(ilc4.ilc_poly);
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5414
                        ilc4.ilc_poly = 0;
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5415
                    }
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5416
                    last4 = aSelector;
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  5417
                }
5495
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5418
                RETURN ( (*ilc4.ilc_func)(self, aSelector, nil, &ilc4,
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5419
                                                argP[0], argP[1], argP[2], argP[3]));
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  5420
            }
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  5421
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  5422
        case 5: 
5495
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5423
            {
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5424
                static OBJ last5 = nil; static struct inlineCache ilc5 = __ILCPERF5(@line);
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5425
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5426
                if ((InterruptPending != nil) || (aSelector != last5)) {
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5427
                    ilc5.ilc_func = __SEND5ADDR__;
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5428
                    if (ilc5.ilc_poly) {
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5429
                        __flushPolyCache(ilc5.ilc_poly);
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5430
                        ilc5.ilc_poly = 0;
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5431
                    }
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5432
                    last5 = aSelector;
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  5433
                }
5495
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5434
                RETURN ( (*ilc5.ilc_func)(self, aSelector, nil, &ilc5, 
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5435
                                                argP[0], argP[1], argP[2], argP[3], argP[4]));
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  5436
            }
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  5437
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  5438
        case 6: 
5495
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5439
            {
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5440
                static OBJ last6 = nil; static struct inlineCache ilc6 = __ILCPERF6(@line);
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5441
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5442
                if ((InterruptPending != nil) || (aSelector != last6)) {
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5443
                    ilc6.ilc_func = __SEND6ADDR__;
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5444
                    if (ilc6.ilc_poly) {
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5445
                        __flushPolyCache(ilc6.ilc_poly);
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5446
                        ilc6.ilc_poly = 0;
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5447
                    }
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5448
                    last6 = aSelector;
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  5449
                }
5495
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5450
                RETURN ( (*ilc6.ilc_func)(self, aSelector, nil, &ilc6, 
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5451
                                                argP[0], argP[1], argP[2], argP[3], argP[4],
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5452
                                                argP[5]));
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  5453
            }
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  5454
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  5455
        case 7: 
5495
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5456
            {
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5457
                static OBJ last7 = nil; static struct inlineCache ilc7 = __ILCPERF7(@line);
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5458
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5459
                if ((InterruptPending != nil) || (aSelector != last7)) {
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5460
                    ilc7.ilc_func = __SEND7ADDR__;
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5461
                    if (ilc7.ilc_poly) {
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5462
                        __flushPolyCache(ilc7.ilc_poly);
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5463
                        ilc7.ilc_poly = 0;
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5464
                    }
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5465
                    last7 = aSelector;
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  5466
                }
5495
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5467
                RETURN ( (*ilc7.ilc_func)(self, aSelector, nil, &ilc7, 
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5468
                                                argP[0], argP[1], argP[2], argP[3], argP[4],
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5469
                                                argP[5], argP[6]));
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  5470
            }
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  5471
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  5472
        case 8:
5495
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5473
            {
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5474
                static OBJ last8 = nil; static struct inlineCache ilc8 = __ILCPERF8(@line);
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5475
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5476
                if ((InterruptPending != nil) || (aSelector != last8)) {
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5477
                    ilc8.ilc_func = __SEND8ADDR__;
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5478
                    if (ilc8.ilc_poly) {
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5479
                        __flushPolyCache(ilc8.ilc_poly);
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5480
                        ilc8.ilc_poly = 0;
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5481
                    }
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5482
                    last8 = aSelector;
5457
e447e2f06b58 oops - performWithArguments was wrong with 8+ arguments.
Claus Gittinger <cg@exept.de>
parents: 5452
diff changeset
  5483
                }
5495
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5484
                RETURN ( (*ilc8.ilc_func)(self, aSelector, nil, &ilc8, 
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5485
                                                argP[0], argP[1], argP[2], argP[3], argP[4],
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5486
                                                argP[5], argP[6], argP[7]));
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  5487
            }
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  5488
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  5489
        case 9: 
5495
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5490
            {
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5491
                static OBJ last9 = nil; static struct inlineCache ilc9 = __ILCPERF9(@line);
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5492
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5493
                if ((InterruptPending != nil) || (aSelector != last9)) {
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5494
                    ilc9.ilc_func = __SEND9ADDR__;
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5495
                    if (ilc9.ilc_poly) {
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5496
                        __flushPolyCache(ilc9.ilc_poly);
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5497
                        ilc9.ilc_poly = 0;
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5498
                    }
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5499
                    last9 = aSelector;
5457
e447e2f06b58 oops - performWithArguments was wrong with 8+ arguments.
Claus Gittinger <cg@exept.de>
parents: 5452
diff changeset
  5500
                }
5495
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5501
                RETURN ( (*ilc9.ilc_func)(self, aSelector, nil, &ilc9, 
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5502
                                                argP[0], argP[1], argP[2], argP[3], argP[4],
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5503
                                                argP[5], argP[6], argP[7], argP[8]));
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  5504
            }
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  5505
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  5506
        case 10: 
5495
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5507
            {
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5508
                static OBJ last10 = nil; static struct inlineCache ilc10 = __ILCPERF10(@line);
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5509
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5510
                if ((InterruptPending != nil) || (aSelector != last10)) {
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5511
                    ilc10.ilc_func = __SEND10ADDR__;
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5512
                    if (ilc10.ilc_poly) {
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5513
                        __flushPolyCache(ilc10.ilc_poly);
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5514
                        ilc10.ilc_poly = 0;
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5515
                    }
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5516
                    last10 = aSelector;
5457
e447e2f06b58 oops - performWithArguments was wrong with 8+ arguments.
Claus Gittinger <cg@exept.de>
parents: 5452
diff changeset
  5517
                }
5495
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5518
                RETURN ( (*ilc10.ilc_func)(self, aSelector, nil, &ilc10, 
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5519
                                                argP[0], argP[1], argP[2], argP[3], argP[4],
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5520
                                                argP[5], argP[6], argP[7], argP[8], argP[9]));
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  5521
            }
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  5522
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  5523
        case 11: 
5495
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5524
            {
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5525
                static OBJ last11 = nil; static struct inlineCache ilc11 = __ILCPERF11(@line);
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5526
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5527
                if ((InterruptPending != nil) || (aSelector != last11)) {
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5528
                    ilc11.ilc_func = __SEND11ADDR__;
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5529
                    if (ilc11.ilc_poly) {
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5530
                        __flushPolyCache(ilc11.ilc_poly);
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5531
                        ilc11.ilc_poly = 0;
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5532
                    }
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5533
                    last11 = aSelector;
5457
e447e2f06b58 oops - performWithArguments was wrong with 8+ arguments.
Claus Gittinger <cg@exept.de>
parents: 5452
diff changeset
  5534
                }
5495
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5535
                RETURN ( (*ilc11.ilc_func)(self, aSelector, nil, &ilc11, 
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5536
                                                argP[0], argP[1], argP[2], argP[3], argP[4],
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5537
                                                argP[5], argP[6], argP[7], argP[8], argP[9],
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5538
                                                argP[10]));
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  5539
            }
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  5540
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  5541
        case 12: 
5495
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5542
            {
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5543
                static OBJ last12 = nil; static struct inlineCache ilc12 = __ILCPERF12(@line);
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5544
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5545
                if ((InterruptPending != nil) || (aSelector != last12)) {
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5546
                    ilc12.ilc_func = __SEND12ADDR__;
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5547
                    if (ilc12.ilc_poly) {
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5548
                        __flushPolyCache(ilc12.ilc_poly);
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5549
                        ilc12.ilc_poly = 0;
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5550
                    }
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5551
                    last12 = aSelector;
5457
e447e2f06b58 oops - performWithArguments was wrong with 8+ arguments.
Claus Gittinger <cg@exept.de>
parents: 5452
diff changeset
  5552
                }
5495
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5553
                RETURN ( (*ilc12.ilc_func)(self, aSelector, nil, &ilc12, 
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5554
                                                argP[0], argP[1], argP[2], argP[3], argP[4],
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5555
                                                argP[5], argP[6], argP[7], argP[8], argP[9],
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5556
                                                argP[10], argP[11]));
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  5557
            }
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  5558
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  5559
        case 13: 
5495
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5560
            {
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5561
                static OBJ last13 = nil; static struct inlineCache ilc13 = __ILCPERF13(@line);
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5562
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5563
                if ((InterruptPending != nil) || (aSelector != last13)) {
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5564
                    ilc13.ilc_func = __SEND13ADDR__;
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5565
                    if (ilc13.ilc_poly) {
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5566
                        __flushPolyCache(ilc13.ilc_poly);
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5567
                        ilc13.ilc_poly = 0;
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5568
                    }
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5569
                    last13 = aSelector;
5457
e447e2f06b58 oops - performWithArguments was wrong with 8+ arguments.
Claus Gittinger <cg@exept.de>
parents: 5452
diff changeset
  5570
                }
5495
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5571
                RETURN ( (*ilc13.ilc_func)(self, aSelector, nil, &ilc13, 
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5572
                                                argP[0], argP[1], argP[2], argP[3], argP[4],
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5573
                                                argP[5], argP[6], argP[7], argP[8], argP[9],
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5574
                                                argP[10], argP[11], argP[12]));
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  5575
            }
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  5576
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  5577
        case 14: 
5495
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5578
            {
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5579
                static OBJ last14 = nil; static struct inlineCache ilc14 = __ILCPERF14(@line);
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5580
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5581
                if ((InterruptPending != nil) || (aSelector != last14)) {
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5582
                    ilc14.ilc_func = __SEND14ADDR__;
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5583
                    if (ilc14.ilc_poly) {
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5584
                        __flushPolyCache(ilc14.ilc_poly);
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5585
                        ilc14.ilc_poly = 0;
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5586
                    }
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5587
                    last14 = aSelector;
5457
e447e2f06b58 oops - performWithArguments was wrong with 8+ arguments.
Claus Gittinger <cg@exept.de>
parents: 5452
diff changeset
  5588
                }
5495
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5589
                RETURN ( (*ilc14.ilc_func)(self, aSelector, nil, &ilc14, 
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5590
                                                argP[0], argP[1], argP[2], argP[3], argP[4],
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5591
                                                argP[5], argP[6], argP[7], argP[8], argP[9],
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5592
                                                argP[10], argP[11], argP[12], argP[13]));
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  5593
            }
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  5594
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  5595
        case 15: 
5495
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5596
            {
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5597
                static OBJ last15 = nil; static struct inlineCache ilc15 = __ILCPERF15(@line);
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5598
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5599
                if ((InterruptPending != nil) || (aSelector != last15)) {
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5600
                    ilc15.ilc_func = __SEND15ADDR__;
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5601
                    if (ilc15.ilc_poly) {
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5602
                        __flushPolyCache(ilc15.ilc_poly);
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5603
                        ilc15.ilc_poly = 0;
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5604
                    }
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5605
                    last15 = aSelector;
5457
e447e2f06b58 oops - performWithArguments was wrong with 8+ arguments.
Claus Gittinger <cg@exept.de>
parents: 5452
diff changeset
  5606
                }
5495
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5607
                RETURN ( (*ilc15.ilc_func)(self, aSelector, nil, &ilc15, 
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5608
                                                argP[0], argP[1], argP[2], argP[3], argP[4],
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5609
                                                argP[5], argP[6], argP[7], argP[8], argP[9],
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5610
                                                argP[10], argP[11], argP[12], argP[13],
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5611
                                                argP[14]));
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  5612
            }
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  5613
    }
2895
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  5614
bad:;
1626
b3b69b572627 comments
Claus Gittinger <cg@exept.de>
parents: 1624
diff changeset
  5615
%}.
5495
d42dbc9ac39d better caching in #perform:withArguments:
Claus Gittinger <cg@exept.de>
parents: 5479
diff changeset
  5616
1626
b3b69b572627 comments
Claus Gittinger <cg@exept.de>
parents: 1624
diff changeset
  5617
    "/ arrive here, if bad number of arguments (too many)
b3b69b572627 comments
Claus Gittinger <cg@exept.de>
parents: 1624
diff changeset
  5618
    "/ ST/X (currently) only allows up to 15 method arguments
b3b69b572627 comments
Claus Gittinger <cg@exept.de>
parents: 1624
diff changeset
  5619
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  5620
    ^ self primitiveFailed
2819
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  5621
!
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  5622
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  5623
performMethod:aMethod
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  5624
    "invoke aMethod on the receiver.
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  5625
     The method should be a zero-argument method.
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  5626
     This is a non-object-oriented entry, applying a method
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  5627
     in a functional way on a receiver.
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  5628
     Warning:
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  5629
         Take care for the method to be appropriate for the
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  5630
         receiver - no checking is done by the VM."
2819
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  5631
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  5632
    ^ aMethod valueWithReceiver:self arguments:#()
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  5633
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  5634
    "
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  5635
     |mthd|
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  5636
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  5637
     mthd := SmallInteger compiledMethodAt:#negated.
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  5638
     Transcript showCR:(1 performMethod:mthd)
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  5639
    "
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  5640
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  5641
    "BAD USE example:
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  5642
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  5643
     |mthd|
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  5644
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  5645
     mthd := Point compiledMethodAt:#x.
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  5646
     Transcript showCR:((1->2) performMethod:mthd)
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  5647
    "
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  5648
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  5649
    "Modified: 31.7.1997 / 17:41:50 / cg"
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  5650
!
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  5651
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  5652
performMethod:aMethod arguments:argumentArray
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  5653
    "invoke aMethod on the receiver, passing an argumentArray.
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  5654
     The size of the argumentArray should match the number of args
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  5655
     expected by the method.
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  5656
     This is a non-object-oriented entry, applying a method
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  5657
     in a functional way on a receiver.
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  5658
     Warning:
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  5659
         Take care for the method to be appropriate for the
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  5660
         receiver - no checking is done by the VM."
2819
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  5661
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  5662
    ^ aMethod valueWithReceiver:self arguments:argumentArray
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  5663
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  5664
    "
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  5665
     |mthd|
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  5666
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  5667
     mthd := SmallInteger compiledMethodAt:#+.
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  5668
     Transcript showCR:(1 performMethod:mthd arguments:#(2))
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  5669
    "
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  5670
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  5671
    "Created: 31.7.1997 / 17:46:31 / cg"
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  5672
!
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  5673
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  5674
performMethod:aMethod with:arg
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  5675
    "invoke aMethod on the receiver, passing an argument.
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  5676
     The method should be a one-argument method.
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  5677
     This is a non-object-oriented entry, applying a method
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  5678
     in a functional way on a receiver.
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  5679
     Warning:
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  5680
         Take care for the method to be appropriate for the
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  5681
         receiver - no checking is done by the VM."
2819
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  5682
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  5683
    ^ aMethod valueWithReceiver:self arguments:(Array with:arg)
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  5684
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  5685
    "
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  5686
     |mthd|
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  5687
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  5688
     mthd := SmallInteger compiledMethodAt:#+.
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  5689
     Transcript showCR:(1 performMethod:mthd with:2)
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  5690
    "
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  5691
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  5692
    "Modified: 31.7.1997 / 17:42:32 / cg"
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  5693
!
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  5694
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  5695
performMethod:aMethod with:arg1 with:arg2
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  5696
    "invoke aMethod on the receiver, passing two arguments.
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  5697
     The method should be a two-argument method.
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  5698
     This is a non-object-oriented entry, applying a method
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  5699
     in a functional way on a receiver.
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  5700
     Warning:
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  5701
         Take care for the method to be appropriate for the
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  5702
         receiver - no checking is done by the VM."
2819
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  5703
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  5704
    ^ aMethod valueWithReceiver:self arguments:(Array with:arg1 with:arg2)
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  5705
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  5706
    "
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  5707
     |mthd arr|
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  5708
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  5709
     arr := Array new:1.
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  5710
     mthd := Array compiledMethodAt:#basicAt:put:.
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  5711
     arr performMethod:mthd with:1 with:'foo'.
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  5712
     Transcript showCR:arr
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  5713
    "
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  5714
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  5715
    "Modified: 31.7.1997 / 17:44:54 / cg"
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  5716
!
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  5717
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  5718
performMethod:aMethod with:arg1 with:arg2 with:arg3
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  5719
    "invoke aMethod on the receiver, passing three arguments.
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  5720
     The method should be a three-argument method.
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  5721
     This is a non-object-oriented entry, applying a method
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  5722
     in a functional way on a receiver.
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  5723
     Warning:
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  5724
         Take care for the method to be appropriate for the
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  5725
         receiver - no checking is done by the VM."
2819
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  5726
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  5727
    ^ aMethod valueWithReceiver:self arguments:(Array with:arg1 with:arg2 with:arg3)
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  5728
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  5729
    "Created: 31.7.1997 / 17:45:20 / cg"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  5730
! !
a27a279701f8 Initial revision
claus
parents:
diff changeset
  5731
a27a279701f8 Initial revision
claus
parents:
diff changeset
  5732
!Object methodsFor:'printing & storing'!
a27a279701f8 Initial revision
claus
parents:
diff changeset
  5733
a27a279701f8 Initial revision
claus
parents:
diff changeset
  5734
className
a27a279701f8 Initial revision
claus
parents:
diff changeset
  5735
    "return the classname of the receivers class"
a27a279701f8 Initial revision
claus
parents:
diff changeset
  5736
a27a279701f8 Initial revision
claus
parents:
diff changeset
  5737
    ^ self class name
56
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
  5738
293
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  5739
    "
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  5740
     1 className
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  5741
     1 class className   'this may change ...'
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  5742
     $a className
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  5743
     $a class className  'this may change ...'
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  5744
    "
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  5745
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
  5746
a27a279701f8 Initial revision
claus
parents:
diff changeset
  5747
classNameWithArticle
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  5748
    "return a string consisting of classname preceeded by an article.
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  5749
     (dont expect me to write national variants for this ... :-)
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  5750
     If you have special preferences, redefine it ..."
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  5751
1391
c2e4f3ee163c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  5752
    |classname cls|
c2e4f3ee163c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  5753
c2e4f3ee163c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  5754
    (cls := self class) == self ifTrue:[
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  5755
        ^ 'a funny object'
1391
c2e4f3ee163c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  5756
    ].
c2e4f3ee163c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  5757
    classname := cls displayString.
85
claus
parents: 77
diff changeset
  5758
    ^ classname article , ' ' , classname
56
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
  5759
293
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  5760
    "
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  5761
     1 classNameWithArticle
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  5762
     (1->2) classNameWithArticle
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  5763
     XWorkstation basicNew classNameWithArticle
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  5764
    "
1391
c2e4f3ee163c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  5765
c2e4f3ee163c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  5766
    "Modified: 13.5.1996 / 12:16:14 / cg"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  5767
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
  5768
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5769
errorPrint
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5770
    "print the receiver on the standard error stream."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5771
1089
6df9414b354f catch errors while errorPrinting (happened when controlling xterm was closed)
Claus Gittinger <cg@exept.de>
parents: 1085
diff changeset
  5772
    Stream streamErrorSignal catch:[
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  5773
        self printOn:Stderr
1089
6df9414b354f catch errors while errorPrinting (happened when controlling xterm was closed)
Claus Gittinger <cg@exept.de>
parents: 1085
diff changeset
  5774
    ]
6df9414b354f catch errors while errorPrinting (happened when controlling xterm was closed)
Claus Gittinger <cg@exept.de>
parents: 1085
diff changeset
  5775
6df9414b354f catch errors while errorPrinting (happened when controlling xterm was closed)
Claus Gittinger <cg@exept.de>
parents: 1085
diff changeset
  5776
    "Modified: 7.3.1996 / 19:11:29 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5777
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5778
1425
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  5779
errorPrintCR
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  5780
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  5781
1089
6df9414b354f catch errors while errorPrinting (happened when controlling xterm was closed)
Claus Gittinger <cg@exept.de>
parents: 1085
diff changeset
  5782
    "print the receiver followed by a cr on the standard error stream."
6df9414b354f catch errors while errorPrinting (happened when controlling xterm was closed)
Claus Gittinger <cg@exept.de>
parents: 1085
diff changeset
  5783
6df9414b354f catch errors while errorPrinting (happened when controlling xterm was closed)
Claus Gittinger <cg@exept.de>
parents: 1085
diff changeset
  5784
    Stream streamErrorSignal catch:[
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  5785
        self printOn:Stderr.
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  5786
        Stderr cr
1089
6df9414b354f catch errors while errorPrinting (happened when controlling xterm was closed)
Claus Gittinger <cg@exept.de>
parents: 1085
diff changeset
  5787
    ]
6df9414b354f catch errors while errorPrinting (happened when controlling xterm was closed)
Claus Gittinger <cg@exept.de>
parents: 1085
diff changeset
  5788
6df9414b354f catch errors while errorPrinting (happened when controlling xterm was closed)
Claus Gittinger <cg@exept.de>
parents: 1085
diff changeset
  5789
    "Modified: 7.3.1996 / 19:13:01 / cg"
1425
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  5790
    "Created: 20.5.1996 / 10:20:41 / cg"
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  5791
!
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  5792
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  5793
errorPrintNL
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  5794
    "{ Pragma: +optSpace }"
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  5795
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  5796
    "print the receiver followed by a cr on the standard error stream.
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  5797
     Please use #errorPrintCR - this method exists for backward compatibility."
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  5798
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  5799
    ^ self errorPrintCR
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  5800
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  5801
    "Modified: 20.5.1996 / 10:24:45 / cg"
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  5802
!
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  5803
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  5804
errorPrintNewline
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  5805
    "{ Pragma: +optSpace }"
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  5806
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  5807
    "print the receiver followed by a cr on the standard error stream.
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  5808
     Please use #errorPrintCR - this method exists for backward compatibility."
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  5809
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  5810
    self errorPrintCR.
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  5811
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  5812
    "Modified: 20.5.1996 / 10:24:38 / cg"
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  5813
!
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  5814
356
claus
parents: 348
diff changeset
  5815
infoPrint
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  5816
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  5817
356
claus
parents: 348
diff changeset
  5818
    "print the receiver on the standard error stream.
claus
parents: 348
diff changeset
  5819
     This is meant for information messages which are not warnings
claus
parents: 348
diff changeset
  5820
     or fatal messages.
claus
parents: 348
diff changeset
  5821
     These messages can be turned on/off by 'Object infoPrinting:true/false'"
claus
parents: 348
diff changeset
  5822
2114
706cf3f9019a initialize InfoPrinting flag from VM's setting
Claus Gittinger <cg@exept.de>
parents: 2096
diff changeset
  5823
    InfoPrinting == true ifTrue:[
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  5824
        self errorPrint
356
claus
parents: 348
diff changeset
  5825
    ]
claus
parents: 348
diff changeset
  5826
!
claus
parents: 348
diff changeset
  5827
1425
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  5828
infoPrintCR
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  5829
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  5830
356
claus
parents: 348
diff changeset
  5831
    "print the receiver followed by a cr on the standard error stream.
claus
parents: 348
diff changeset
  5832
     This is meant for information messages which are not warnings
claus
parents: 348
diff changeset
  5833
     or fatal messages.
claus
parents: 348
diff changeset
  5834
     These messages can be turned on/off by 'Object infoPrinting:true/false'"
claus
parents: 348
diff changeset
  5835
2114
706cf3f9019a initialize InfoPrinting flag from VM's setting
Claus Gittinger <cg@exept.de>
parents: 2096
diff changeset
  5836
    InfoPrinting == true ifTrue:[
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  5837
        self errorPrintCR
356
claus
parents: 348
diff changeset
  5838
    ]
1425
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  5839
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  5840
    "Created: 20.5.1996 / 10:21:28 / cg"
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  5841
!
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  5842
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  5843
infoPrintNL
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  5844
    "{ Pragma: +optSpace }"
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  5845
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  5846
    "print the receiver followed by a cr on the standard error stream.
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  5847
     This is meant for information messages which are not warnings
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  5848
     or fatal messages.
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  5849
     These messages can be turned on/off by 'Object infoPrinting:true/false'.
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  5850
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  5851
     Please use #infoPrintCR - this method exists for backward compatibility."
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  5852
2114
706cf3f9019a initialize InfoPrinting flag from VM's setting
Claus Gittinger <cg@exept.de>
parents: 2096
diff changeset
  5853
    ^ self infoPrintCR
1425
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  5854
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  5855
    "Modified: 20.5.1996 / 10:25:07 / cg"
356
claus
parents: 348
diff changeset
  5856
!
claus
parents: 348
diff changeset
  5857
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5858
print
1887
364cff2aec4e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1867
diff changeset
  5859
    "print the receiver on the standard output stream (which is not the Transcript)"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5860
5452
71fd110c347a allow print, printCR during early initialization
Claus Gittinger <cg@exept.de>
parents: 5424
diff changeset
  5861
    "/ the following allows printCR to be used during
71fd110c347a allow print, printCR during early initialization
Claus Gittinger <cg@exept.de>
parents: 5424
diff changeset
  5862
    "/ the early init-phase, when no Stdout has been set up.
71fd110c347a allow print, printCR during early initialization
Claus Gittinger <cg@exept.de>
parents: 5424
diff changeset
  5863
    "/ (depends on string to respond to #print)
71fd110c347a allow print, printCR during early initialization
Claus Gittinger <cg@exept.de>
parents: 5424
diff changeset
  5864
71fd110c347a allow print, printCR during early initialization
Claus Gittinger <cg@exept.de>
parents: 5424
diff changeset
  5865
    Stdout isNil ifTrue:[
71fd110c347a allow print, printCR during early initialization
Claus Gittinger <cg@exept.de>
parents: 5424
diff changeset
  5866
        self printString print.
71fd110c347a allow print, printCR during early initialization
Claus Gittinger <cg@exept.de>
parents: 5424
diff changeset
  5867
        ^ self
71fd110c347a allow print, printCR during early initialization
Claus Gittinger <cg@exept.de>
parents: 5424
diff changeset
  5868
    ].
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5869
    self printOn:Stdout
1887
364cff2aec4e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1867
diff changeset
  5870
364cff2aec4e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1867
diff changeset
  5871
    "Modified: 4.11.1996 / 23:36:58 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5872
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5873
1425
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  5874
printCR
1887
364cff2aec4e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1867
diff changeset
  5875
    "print the receiver followed by a cr on the standard output stream (which is not the Transcript)"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5876
5452
71fd110c347a allow print, printCR during early initialization
Claus Gittinger <cg@exept.de>
parents: 5424
diff changeset
  5877
    "/ the following allows printCR to be used during
71fd110c347a allow print, printCR during early initialization
Claus Gittinger <cg@exept.de>
parents: 5424
diff changeset
  5878
    "/ the early init-phase, when no Stdout has been set up.
71fd110c347a allow print, printCR during early initialization
Claus Gittinger <cg@exept.de>
parents: 5424
diff changeset
  5879
    "/ (depends on string to respond to #printCR)
71fd110c347a allow print, printCR during early initialization
Claus Gittinger <cg@exept.de>
parents: 5424
diff changeset
  5880
71fd110c347a allow print, printCR during early initialization
Claus Gittinger <cg@exept.de>
parents: 5424
diff changeset
  5881
    Stdout isNil ifTrue:[
71fd110c347a allow print, printCR during early initialization
Claus Gittinger <cg@exept.de>
parents: 5424
diff changeset
  5882
        self printString printCR.
71fd110c347a allow print, printCR during early initialization
Claus Gittinger <cg@exept.de>
parents: 5424
diff changeset
  5883
        ^ self
71fd110c347a allow print, printCR during early initialization
Claus Gittinger <cg@exept.de>
parents: 5424
diff changeset
  5884
    ].
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5885
    self printOn:Stdout.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5886
    Stdout cr
1425
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  5887
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  5888
    "Created: 20.5.1996 / 10:21:37 / cg"
1887
364cff2aec4e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1867
diff changeset
  5889
    "Modified: 4.11.1996 / 23:37:06 / cg"
1425
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  5890
!
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  5891
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  5892
printNL
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  5893
    "print the receiver followed by a cr on the standard output stream
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  5894
     This exists for GNU Smalltalk compatibility - please use #printCR."
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  5895
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  5896
    ^ self printCR
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  5897
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  5898
    "Modified: 20.5.1996 / 10:25:31 / cg"
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  5899
!
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  5900
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  5901
printNewline
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  5902
    "print the receiver followed by a cr on the standard output stream.
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  5903
     This exists for backward compatibility - please use #printCR."
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  5904
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  5905
    self printCR
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  5906
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  5907
    "Modified: 20.5.1996 / 10:25:46 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5908
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5909
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5910
printOn:aStream
4392
26fb48f04e1b comment
Claus Gittinger <cg@exept.de>
parents: 4363
diff changeset
  5911
    "append a user printed representation of the receiver to aStream.
26fb48f04e1b comment
Claus Gittinger <cg@exept.de>
parents: 4363
diff changeset
  5912
     The format is suitable for a human - not meant to be read back.
26fb48f04e1b comment
Claus Gittinger <cg@exept.de>
parents: 4363
diff changeset
  5913
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5914
     The default here is to output the receivers class name.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5915
     BUT: this method is heavily redefined for objects which
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5916
     can print prettier."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5917
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5918
    aStream nextPutAll:self classNameWithArticle
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5919
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5920
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5921
printOn:aStream leftPaddedTo:size
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5922
    "print the receiver on aStream, padding with spaces up to size.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5923
     padding is done on the left."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5924
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5925
    self printOn:aStream leftPaddedTo:size with:(Character space)
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5926
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5927
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5928
     123 printOn:Transcript leftPaddedTo:10. Transcript cr
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5929
     123 printOn:Transcript leftPaddedTo:2. Transcript cr
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5930
    "
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  5931
!
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  5932
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5933
printOn:aStream leftPaddedTo:size with:padCharacter
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5934
    "print the receiver on aStream, padding with padCharacters up to size.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5935
     padding is done on the left."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5936
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5937
    aStream nextPutAll:(self printStringLeftPaddedTo:size with:padCharacter)
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5938
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5939
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5940
     123 printOn:Transcript leftPaddedTo:10 with:$_ . Transcript cr
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5941
     123 printOn:Transcript leftPaddedTo:10 with:$. . Transcript cr
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5942
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5943
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5944
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5945
printOn:aStream paddedTo:size
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5946
    "print the receiver on aStream, padding with spaces up to size."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5947
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5948
    self printOn:aStream paddedTo:size with:(Character space)
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5949
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5950
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5951
     123.0 printOn:Transcript paddedTo:10. Transcript nextPut:$|. Transcript cr
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5952
    "
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  5953
!
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  5954
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5955
printOn:aStream paddedTo:size with:padCharacter
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5956
    "print the receiver on aStream, padding with padCharacter up to size"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5957
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5958
    aStream nextPutAll:(self printStringPaddedTo:size with:padCharacter).
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5959
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5960
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5961
     123 printOn:Transcript paddedTo:10 with:$_ . Transcript cr
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5962
     123 printOn:Transcript paddedTo:10 with:$. . Transcript cr
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5963
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5964
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5965
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5966
printOn:aStream zeroPaddedTo:size
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5967
    "print the receiver on aStream, padding with zeros up to size.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5968
     Usually used with float numbers."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5969
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5970
    self printOn:aStream paddedTo:size with:$0.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5971
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5972
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5973
     123.0 printOn:Transcript zeroPaddedTo:10
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5974
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5975
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5976
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5977
printRightAdjustLen:size
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5978
    "obsolete - just a name confusion.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5979
     This method will go away ..."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5980
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5981
    (self printStringLeftPaddedTo:size) printOn:Stdout
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  5982
!
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  5983
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  5984
printString
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  5985
    "return a string for printing the receiver.
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  5986
     Since we now use printOn: as the basic print mechanism,
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  5987
     we have to create a stream and print into it."
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  5988
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  5989
    |s|
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  5990
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  5991
    s := WriteStream on:(String new:30).
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  5992
    self printOn:s.
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  5993
    ^ s contents
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  5994
!
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  5995
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5996
printStringLeftPaddedTo:size
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5997
    "return my printString as a right-adjusted string of length size;
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5998
     characters on the left are filled with spaces.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5999
     If the printString is longer than size, 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6000
     it is returned unchanged (i.e. not truncated)"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6001
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6002
    ^ self printStringLeftPaddedTo:size with:(Character space)
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6003
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6004
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6005
     10 printStringLeftPaddedTo:10
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6006
     1 printStringLeftPaddedTo:10
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6007
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6008
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6009
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6010
printStringLeftPaddedTo:size ifLarger:alternative
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6011
    "return my printString as a right-adjusted string of length size;
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6012
     characters on the left are filled with spaces.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6013
     If the printString is larger than size,
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6014
     return the result from evaluating alternative."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6015
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6016
    ^ self printStringLeftPaddedTo:size with:(Character space) ifLarger:alternative
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6017
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6018
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6019
     12   printStringLeftPaddedTo:3 ifLarger:['***']
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6020
     123  printStringLeftPaddedTo:3 ifLarger:['***']
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6021
     1234 printStringLeftPaddedTo:3 ifLarger:['***']
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6022
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6023
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6024
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6025
printStringLeftPaddedTo:size with:padCharacter
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6026
    "return my printString as a right-adjusted string of length size;
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6027
     characters on the left are filled with padCharacter.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6028
     If the printString is longer than size, 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6029
     it is returned unchanged (i.e. not truncated)"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6030
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6031
    ^ (self printString) leftPaddedTo:size with:padCharacter
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6032
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6033
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6034
     123 printStringLeftPaddedTo:10 with:$.   
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6035
     1 printStringLeftPaddedTo:10 with:$.      
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6036
     (Float pi) printStringLeftPaddedTo:20 with:$*
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6037
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6038
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6039
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6040
printStringLeftPaddedTo:size with:padCharacter ifLarger:alternative
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6041
    "return my printString as a right-adjusted string of length size;
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6042
     characters on the left are filled with padCharacter.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6043
     If the printString is larger than size,
369
claus
parents: 362
diff changeset
  6044
     return the result from evaluating alternative."
claus
parents: 362
diff changeset
  6045
claus
parents: 362
diff changeset
  6046
    |s|
claus
parents: 362
diff changeset
  6047
claus
parents: 362
diff changeset
  6048
    s := self printString.
claus
parents: 362
diff changeset
  6049
    s size > size ifTrue:[^ alternative value].
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6050
    ^ s leftPaddedTo:size with:padCharacter
369
claus
parents: 362
diff changeset
  6051
claus
parents: 362
diff changeset
  6052
    "
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6053
     12   printStringLeftPaddedTo:3 with:$. ifLarger:['***']   
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6054
     123  printStringLeftPaddedTo:3 with:$. ifLarger:['***']   
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6055
     1234 printStringLeftPaddedTo:3 with:$. ifLarger:['***']   
293
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  6056
    "
13
62303f84ff5f *** empty log message ***
claus
parents: 10
diff changeset
  6057
!
62303f84ff5f *** empty log message ***
claus
parents: 10
diff changeset
  6058
5586
746289c7d9a2 added #printStringOnError:
Claus Gittinger <cg@exept.de>
parents: 5498
diff changeset
  6059
printStringOnError:exceptionBlock
746289c7d9a2 added #printStringOnError:
Claus Gittinger <cg@exept.de>
parents: 5498
diff changeset
  6060
    "return a string for printing the receiver; if any error occurs, return the result from
746289c7d9a2 added #printStringOnError:
Claus Gittinger <cg@exept.de>
parents: 5498
diff changeset
  6061
     evaluating exceptionBlock. Useful to print something in an exceptionHandler or other
746289c7d9a2 added #printStringOnError:
Claus Gittinger <cg@exept.de>
parents: 5498
diff changeset
  6062
     cleanup code."
746289c7d9a2 added #printStringOnError:
Claus Gittinger <cg@exept.de>
parents: 5498
diff changeset
  6063
746289c7d9a2 added #printStringOnError:
Claus Gittinger <cg@exept.de>
parents: 5498
diff changeset
  6064
    |rslt|
746289c7d9a2 added #printStringOnError:
Claus Gittinger <cg@exept.de>
parents: 5498
diff changeset
  6065
746289c7d9a2 added #printStringOnError:
Claus Gittinger <cg@exept.de>
parents: 5498
diff changeset
  6066
    Error handle:[:ex |
746289c7d9a2 added #printStringOnError:
Claus Gittinger <cg@exept.de>
parents: 5498
diff changeset
  6067
        rslt := exceptionBlock value
746289c7d9a2 added #printStringOnError:
Claus Gittinger <cg@exept.de>
parents: 5498
diff changeset
  6068
    ] do:[
746289c7d9a2 added #printStringOnError:
Claus Gittinger <cg@exept.de>
parents: 5498
diff changeset
  6069
        rslt := self printString
746289c7d9a2 added #printStringOnError:
Claus Gittinger <cg@exept.de>
parents: 5498
diff changeset
  6070
    ].
5588
Claus Gittinger <cg@exept.de>
parents: 5586
diff changeset
  6071
    ^ rslt
5586
746289c7d9a2 added #printStringOnError:
Claus Gittinger <cg@exept.de>
parents: 5498
diff changeset
  6072
!
746289c7d9a2 added #printStringOnError:
Claus Gittinger <cg@exept.de>
parents: 5498
diff changeset
  6073
13
62303f84ff5f *** empty log message ***
claus
parents: 10
diff changeset
  6074
printStringPaddedTo:size
56
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
  6075
    "return a printed representation of the receiver,
369
claus
parents: 362
diff changeset
  6076
     padded with spaces (at the right) up to size.
293
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  6077
     If the printString is longer than size, 
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  6078
     it is returned unchanged (i.e. not truncated)"
13
62303f84ff5f *** empty log message ***
claus
parents: 10
diff changeset
  6079
62303f84ff5f *** empty log message ***
claus
parents: 10
diff changeset
  6080
    ^ self printStringPaddedTo:size with:(Character space)
62303f84ff5f *** empty log message ***
claus
parents: 10
diff changeset
  6081
293
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  6082
    "
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  6083
     123 printStringPaddedTo:10    
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  6084
     1234567890123456 printStringPaddedTo:10  
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  6085
     'hello' printStringPaddedTo:10   
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  6086
    "
2
claus
parents: 1
diff changeset
  6087
!
claus
parents: 1
diff changeset
  6088
369
claus
parents: 362
diff changeset
  6089
printStringPaddedTo:size ifLarger:alternative
claus
parents: 362
diff changeset
  6090
    "return a printed representation of the receiver,
claus
parents: 362
diff changeset
  6091
     padded with spaces (at the right) up to size.
claus
parents: 362
diff changeset
  6092
     If the resulting printString is too large, 
claus
parents: 362
diff changeset
  6093
     return the result from evaluating alternative."
claus
parents: 362
diff changeset
  6094
claus
parents: 362
diff changeset
  6095
    ^ self printStringPaddedTo:size with:(Character space) ifLarger:alternative
claus
parents: 362
diff changeset
  6096
claus
parents: 362
diff changeset
  6097
    "
claus
parents: 362
diff changeset
  6098
     12   printStringPaddedTo:3 ifLarger:['***']   
claus
parents: 362
diff changeset
  6099
     123  printStringPaddedTo:3 ifLarger:['***']   
claus
parents: 362
diff changeset
  6100
     1234 printStringPaddedTo:3 ifLarger:['***']   
claus
parents: 362
diff changeset
  6101
    "
claus
parents: 362
diff changeset
  6102
!
claus
parents: 362
diff changeset
  6103
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6104
printStringPaddedTo:size with:padCharacter
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6105
    "return a printed representation of the receiver,
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6106
     padded with padCharacter (at the right) up to size.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6107
     If the printString is longer than size, 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6108
     it is returned unchanged (i.e. not truncated)"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6109
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6110
    ^ (self printString) paddedTo:size with:padCharacter
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6111
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6112
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6113
     123  printStringPaddedTo:10 with:$.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6114
     123  printStringPaddedTo:10 with:$*
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6115
     123  printStringPaddedTo:3 with:$*   
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6116
     1234 printStringPaddedTo:3 with:$*   
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6117
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6118
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6119
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6120
printStringPaddedTo:size with:padCharacter ifLarger:alternative
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6121
    "return a printed representation of the receiver,
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6122
     padded with padCharacter (at the right) up to size.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6123
     If the resulting printString is too large, 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6124
     return the result from evaluating alternative."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6125
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6126
    |s|
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6127
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6128
    s := self printString.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6129
    s size > size ifTrue:[^ alternative value].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6130
    ^ s paddedTo:size with:padCharacter
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6131
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6132
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6133
     123   printStringPaddedTo:3 with:$. ifLarger:['***']
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6134
     12345 printStringPaddedTo:3 with:$. ifLarger:['***']
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6135
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6136
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6137
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6138
printStringRightAdjustLen:size
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6139
    "obsolete - just a name confusion.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6140
     This method will go away ..."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6141
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6142
    ^ self printStringLeftPaddedTo:size
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6143
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6144
2
claus
parents: 1
diff changeset
  6145
printStringZeroPaddedTo:size
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  6146
    "return a printed representation of the receiver, 
369
claus
parents: 362
diff changeset
  6147
     padded with zero (at the right) characters up to size.
13
62303f84ff5f *** empty log message ***
claus
parents: 10
diff changeset
  6148
     Usually used with float numbers."
2
claus
parents: 1
diff changeset
  6149
claus
parents: 1
diff changeset
  6150
    ^ self printStringPaddedTo:size with:$0
13
62303f84ff5f *** empty log message ***
claus
parents: 10
diff changeset
  6151
293
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  6152
    "
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  6153
     123.0 printStringZeroPaddedTo:10 
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  6154
    "
2
claus
parents: 1
diff changeset
  6155
!
claus
parents: 1
diff changeset
  6156
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6157
store
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6158
    "store the receiver on standard output.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6159
     this method is useless, but included for compatibility."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6160
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6161
    self storeOn:Stdout
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  6162
!
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  6163
1425
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  6164
storeCR
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  6165
    "store the receiver on standard output; append a carriage return."
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  6166
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  6167
    self store.
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  6168
    Character cr print
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  6169
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  6170
    "Created: 20.5.1996 / 10:26:01 / cg"
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  6171
    "Modified: 20.5.1996 / 10:26:57 / cg"
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  6172
!
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  6173
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6174
storeNl
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6175
    "store the receiver on standard output; append a newline.
1425
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  6176
     This method is included for backward compatibility-  use #storeCR."
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  6177
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  6178
    self storeCR.
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  6179
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  6180
    "Modified: 20.5.1996 / 10:26:49 / cg"
460
7e058858cc3b New Method: displayOn:aGc at:aPoint (ST80-compatibility).
Stefan Vogel <sv@exept.de>
parents: 446
diff changeset
  6181
!
7e058858cc3b New Method: displayOn:aGc at:aPoint (ST80-compatibility).
Stefan Vogel <sv@exept.de>
parents: 446
diff changeset
  6182
56
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
  6183
storeOn:aStream
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
  6184
    "store the receiver on aStream; i.e. print an expression which will
293
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  6185
     reconstruct the receiver.
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  6186
     Notice, that no self referencing or cyclic objects can be represented
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  6187
     in this format.
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  6188
     Use storeBinaryOn:, which handles these cases correctly."
56
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
  6189
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
  6190
    |myClass hasSemi sz "{ Class: SmallInteger }" |
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  6191
25
e34a6267c79b *** empty log message ***
claus
parents: 13
diff changeset
  6192
    thisContext isRecursive ifTrue:[
5498
489dc2e6bd4f RecursiveStoreStringSignal lifted to Object
tm
parents: 5495
diff changeset
  6193
        Object recursiveStoreStringSignal raiseRequestWith:self.
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6194
        ('Object [error]: storeString of self referencing object.') errorPrintCR.
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6195
        aStream nextPutAll:'#("recursive")'.
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6196
        ^ self
25
e34a6267c79b *** empty log message ***
claus
parents: 13
diff changeset
  6197
    ].
56
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
  6198
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  6199
    myClass := self class.
56
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
  6200
    aStream nextPut:$(.
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
  6201
    aStream nextPutAll:self class name.
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
  6202
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  6203
    hasSemi := false.
a27a279701f8 Initial revision
claus
parents:
diff changeset
  6204
    myClass isVariable ifTrue:[
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6205
        aStream nextPutAll:' basicNew:'.
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6206
        self basicSize printOn:aStream
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  6207
    ] ifFalse:[
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6208
        aStream nextPutAll:' basicNew'
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  6209
    ].
56
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
  6210
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  6211
    sz := myClass instSize.
a27a279701f8 Initial revision
claus
parents:
diff changeset
  6212
    1 to:sz do:[:i | 
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6213
        aStream nextPutAll:' instVarAt:'.
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6214
        i printOn:aStream.
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6215
        aStream nextPutAll:' put:'.
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6216
        (self instVarAt:i) storeOn:aStream.
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6217
        aStream nextPut:$;.
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6218
        hasSemi := true
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  6219
    ].
a27a279701f8 Initial revision
claus
parents:
diff changeset
  6220
    myClass isVariable ifTrue:[
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6221
        sz := self basicSize.
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6222
        1 to:sz do:[:i | 
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6223
            aStream nextPutAll:' basicAt:'.
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6224
            i printOn:aStream.
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6225
            aStream nextPutAll:' put:'.
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6226
            (self basicAt:i) storeOn:aStream.
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6227
            aStream nextPut:$;.
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6228
            hasSemi := true
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6229
        ]
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  6230
    ].
a27a279701f8 Initial revision
claus
parents:
diff changeset
  6231
    hasSemi ifTrue:[
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6232
        aStream nextPutAll:' yourself'
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  6233
    ].
56
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
  6234
    aStream nextPut:$).
293
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  6235
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  6236
    "
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  6237
     |s|
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  6238
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  6239
     s := WriteStream on:(String new).
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  6240
     ('hello' -> 'world') storeOn:s.
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  6241
     s := ReadStream on:(s contents).
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  6242
     (Object readFrom:s) inspect
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  6243
    "
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  6244
    "
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  6245
     |s|
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  6246
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  6247
     s := 'data' asFilename writeStream.
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  6248
     ('hello' -> 'world') storeOn:s.
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  6249
     s close.
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  6250
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  6251
     s := 'data' asFilename readStream.
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  6252
     (Object readFrom:s) inspect
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  6253
    "
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  6254
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  6255
    "does not work example:"
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  6256
    "
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  6257
     |s a|
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  6258
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  6259
     a := Array new:2.
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  6260
     a at:1 put:a.
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  6261
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  6262
     s := 'data' asFilename writeStream.
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  6263
     a storeOn:s.
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  6264
     s close.
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  6265
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  6266
     s := 'data' asFilename readStream.
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  6267
     (Object readFrom:s) inspect
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  6268
    "
1417
59e7d3c1df6d showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1397
diff changeset
  6269
2287
3d5330d2b368 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  6270
    "Modified: 28.1.1997 / 00:36:12 / cg"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  6271
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
  6272
56
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
  6273
storeString
293
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  6274
    "return a string representing an expression to reconstruct the receiver.
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  6275
     Notice, that no self referencing or cyclic objects can be represented
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  6276
     in this format.
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  6277
     Use storeBinaryOn:, which handles these cases correctly."
56
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
  6278
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
  6279
    |s|
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
  6280
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
  6281
    s := WriteStream on:(String new:50).
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
  6282
    self storeOn:s.
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
  6283
    ^ s contents
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6284
! !
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6285
5354
1df6e20fd208 added isHierarchicalItem
ca
parents: 5327
diff changeset
  6286
!Object methodsFor:'private'!
1df6e20fd208 added isHierarchicalItem
ca
parents: 5327
diff changeset
  6287
1df6e20fd208 added isHierarchicalItem
ca
parents: 5327
diff changeset
  6288
isHierarchicalItem
1df6e20fd208 added isHierarchicalItem
ca
parents: 5327
diff changeset
  6289
    "used to decide if the parent is a hierarchical item
1df6e20fd208 added isHierarchicalItem
ca
parents: 5327
diff changeset
  6290
     or the model
1df6e20fd208 added isHierarchicalItem
ca
parents: 5327
diff changeset
  6291
    "
1df6e20fd208 added isHierarchicalItem
ca
parents: 5327
diff changeset
  6292
    ^ false
1df6e20fd208 added isHierarchicalItem
ca
parents: 5327
diff changeset
  6293
! !
1df6e20fd208 added isHierarchicalItem
ca
parents: 5327
diff changeset
  6294
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6295
!Object methodsFor:'queries'!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6296
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6297
basicSize
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6298
    "return the number of the receivers indexed instance variables,
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6299
     0 if it has none.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6300
2148
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
  6301
     This method should NOT be redefined in any subclass (except with great care, for tuning)"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6302
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6303
%{  /* NOCONTEXT */
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6304
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6305
    REGISTER int nbytes;
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6306
    REGISTER OBJ myClass;
3921
8e07cb118aa3 added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents: 3841
diff changeset
  6307
    int nInstBytes;
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6308
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6309
    /*
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6310
     * notice the missing test for self being a nonNilObject -
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6311
     * this can be done since basicSize is defined both in UndefinedObject
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6312
     * and SmallInteger
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6313
     */
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6314
    myClass = __qClass(self);
3921
8e07cb118aa3 added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents: 3841
diff changeset
  6315
    nbytes = __qSize(self);
8e07cb118aa3 added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents: 3841
diff changeset
  6316
    nInstBytes = OHDR_SIZE + __OBJS2BYTES__( __intVal(__ClassInstPtr(myClass)->c_ninstvars) );
1133
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1129
diff changeset
  6317
3159
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
  6318
    switch ((INT)(__ClassInstPtr(myClass)->c_flags) & __MASKSMALLINT(ARRAYMASK)) {
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6319
        case __MASKSMALLINT(POINTERARRAY):
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6320
        case __MASKSMALLINT(WKPOINTERARRAY):
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6321
            nbytes -= nInstBytes;
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6322
            RETURN ( __MKSMALLINT(__BYTES2OBJS__(nbytes)) );
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6323
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6324
        case __MASKSMALLINT(BYTEARRAY):
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6325
            nbytes -= nInstBytes;
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6326
            RETURN ( __MKSMALLINT(nbytes / sizeof(char)) );
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6327
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6328
        case __MASKSMALLINT(FLOATARRAY):
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6329
            nbytes -= nInstBytes;
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6330
            RETURN ( __MKSMALLINT(nbytes / sizeof(float)) );
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6331
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6332
        case __MASKSMALLINT(DOUBLEARRAY):
3921
8e07cb118aa3 added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents: 3841
diff changeset
  6333
#ifdef __NEED_DOUBLE_ALIGN
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6334
            nInstBytes = (nInstBytes-1+__DOUBLE_ALIGN) &~ (__DOUBLE_ALIGN-1);
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6335
#endif
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6336
            nbytes -= nInstBytes;
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6337
            RETURN ( __MKSMALLINT(nbytes / sizeof(double)) );
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6338
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6339
        case __MASKSMALLINT(WORDARRAY):
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6340
        case __MASKSMALLINT(SWORDARRAY):
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6341
            nbytes -= nInstBytes;
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6342
            RETURN ( __MKSMALLINT(nbytes>>1) ); /* notice the hardcoded 2 here - not sizeof(short) */
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6343
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6344
        case __MASKSMALLINT(LONGARRAY):
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6345
        case __MASKSMALLINT(SLONGARRAY):
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6346
            nbytes -= nInstBytes;
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6347
            RETURN ( __MKSMALLINT(nbytes>>2) ); /* notice the hardcoded 4 here - not sizeof(int) */
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6348
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6349
        case __MASKSMALLINT(LONGLONGARRAY):
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6350
        case __MASKSMALLINT(SLONGLONGARRAY):
3921
8e07cb118aa3 added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents: 3841
diff changeset
  6351
#ifdef __NEED_LONGLONG_ALIGN
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6352
            nInstBytes = (nInstBytes-1+__LONGLONG_ALIGN) &~ (__LONGLONG_ALIGN-1);
3921
8e07cb118aa3 added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents: 3841
diff changeset
  6353
#endif
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6354
            nbytes -= nInstBytes;
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6355
            RETURN ( __MKSMALLINT(nbytes>>3) ); /* notice the hardcoded 8 here - not sizeof(long long) */
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6356
    }
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6357
%}.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6358
    ^ 0
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  6359
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
  6360
2575
797f7408e03c added #byteSize (for binary storage)
Claus Gittinger <cg@exept.de>
parents: 2574
diff changeset
  6361
byteSize
797f7408e03c added #byteSize (for binary storage)
Claus Gittinger <cg@exept.de>
parents: 2574
diff changeset
  6362
    "return the number of bytes in the receivers indexed instance variables,
797f7408e03c added #byteSize (for binary storage)
Claus Gittinger <cg@exept.de>
parents: 2574
diff changeset
  6363
     0 if it has none. This only returns non-zero for non-pointer indexed
797f7408e03c added #byteSize (for binary storage)
Claus Gittinger <cg@exept.de>
parents: 2574
diff changeset
  6364
     instvars i.e. byteArrays, wordArrays etc.
797f7408e03c added #byteSize (for binary storage)
Claus Gittinger <cg@exept.de>
parents: 2574
diff changeset
  6365
     Notice: for Strings the returned size may look strange.
797f7408e03c added #byteSize (for binary storage)
Claus Gittinger <cg@exept.de>
parents: 2574
diff changeset
  6366
     Only useful with binary storage."
797f7408e03c added #byteSize (for binary storage)
Claus Gittinger <cg@exept.de>
parents: 2574
diff changeset
  6367
3921
8e07cb118aa3 added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents: 3841
diff changeset
  6368
    |myClass|
8e07cb118aa3 added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents: 3841
diff changeset
  6369
8e07cb118aa3 added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents: 3841
diff changeset
  6370
    myClass := self class.
8e07cb118aa3 added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents: 3841
diff changeset
  6371
    myClass isVariable ifTrue:[
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6372
        myClass isPointers ifFalse:[
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6373
            myClass isBytes ifTrue:[
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6374
                ^ self basicSize.
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6375
            ].
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6376
            myClass isWords ifTrue:[
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6377
                ^ self basicSize * 2.
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6378
            ].
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6379
            myClass isSignedWords ifTrue:[
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6380
                ^ self basicSize * 2.
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6381
            ].
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6382
            myClass isLongs ifTrue:[
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6383
                ^ self basicSize * 4.
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6384
            ].
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6385
            myClass isSignedLongs ifTrue:[
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6386
                ^ self basicSize * 4.
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6387
            ].
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6388
            myClass isLongLongs ifTrue:[
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6389
                ^ self basicSize * 8.
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6390
            ].
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6391
            myClass isSignedLongLongs ifTrue:[
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6392
                ^ self basicSize * 8.
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6393
            ].
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6394
            myClass isFloats ifTrue:[
5421
6dda4984b524 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5418
diff changeset
  6395
                ^ self basicSize * (ExternalBytes sizeofFloat)
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6396
            ].
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6397
            myClass isDoubles ifTrue:[
5421
6dda4984b524 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5418
diff changeset
  6398
                ^ self basicSize * (ExternalBytes sizeofDouble)
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6399
            ].
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6400
            self halt:'oops'.
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6401
        ]
3921
8e07cb118aa3 added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents: 3841
diff changeset
  6402
    ].
2575
797f7408e03c added #byteSize (for binary storage)
Claus Gittinger <cg@exept.de>
parents: 2574
diff changeset
  6403
    ^ 0
797f7408e03c added #byteSize (for binary storage)
Claus Gittinger <cg@exept.de>
parents: 2574
diff changeset
  6404
797f7408e03c added #byteSize (for binary storage)
Claus Gittinger <cg@exept.de>
parents: 2574
diff changeset
  6405
    "
797f7408e03c added #byteSize (for binary storage)
Claus Gittinger <cg@exept.de>
parents: 2574
diff changeset
  6406
     Point new byteSize   
797f7408e03c added #byteSize (for binary storage)
Claus Gittinger <cg@exept.de>
parents: 2574
diff changeset
  6407
     'hello' byteSize     
797f7408e03c added #byteSize (for binary storage)
Claus Gittinger <cg@exept.de>
parents: 2574
diff changeset
  6408
     (ByteArray with:1 with:2) byteSize 
797f7408e03c added #byteSize (for binary storage)
Claus Gittinger <cg@exept.de>
parents: 2574
diff changeset
  6409
     (FloatArray with:1.5) byteSize    
3921
8e07cb118aa3 added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents: 3841
diff changeset
  6410
     (DoubleArray with:1.5) byteSize    
8e07cb118aa3 added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents: 3841
diff changeset
  6411
     (WordArray with:1 with:2) byteSize    
2575
797f7408e03c added #byteSize (for binary storage)
Claus Gittinger <cg@exept.de>
parents: 2574
diff changeset
  6412
    "
797f7408e03c added #byteSize (for binary storage)
Claus Gittinger <cg@exept.de>
parents: 2574
diff changeset
  6413
!
797f7408e03c added #byteSize (for binary storage)
Claus Gittinger <cg@exept.de>
parents: 2574
diff changeset
  6414
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6415
class
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6416
    "return the receivers class"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6417
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6418
%{  /* NOCONTEXT */
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6419
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6420
    RETURN ( __Class(self) );
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6421
%}
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6422
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6423
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6424
respondsTo:aSelector
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6425
    "return true, if the receiver implements a method with selector equal
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6426
     to aSelector; i.e. if there is a method for aSelector in either the
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6427
     receivers class or one of its superclasses.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6428
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6429
     Notice, that this does not imply, that such a message can be sent without
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6430
     an error being raised. For example, an implementation could send
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6431
     #shouldNotImplement or #subclassResponsibility."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6432
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6433
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6434
     should we go via the cache, or search (by class) ?
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6435
     The first is faster, most of the time; while the 2nd fills
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6436
     the cache with useless data if this is sent in a loop over all objects.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6437
     For now, use the cache ...
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6438
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6439
%{  /* NOCONTEXT */
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6440
829
fc386319f41c removed external function defs (soon no longer allowed)
Claus Gittinger <cg@exept.de>
parents: 816
diff changeset
  6441
    if (__lookup(__Class(self), aSelector) == nil) {
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6442
        RETURN ( false );
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6443
    }
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6444
    RETURN ( true );
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6445
%}
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6446
.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6447
    ^ self class canUnderstand:aSelector
5418
b456f99b6c8c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5408
diff changeset
  6448
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6449
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6450
    "'aString' respondsTo:#+"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6451
    "'aString' respondsTo:#,"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6452
    "'aString' respondsTo:#collect:"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6453
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6454
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6455
respondsToArithmetic
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6456
    "return true, if the receiver responds to arithmetic messages.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6457
     false is returned here - the method is redefined in ArithmeticValue."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6458
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6459
    ^ false
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6460
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6461
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6462
size
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6463
    "return the number of the receivers indexed instance variables;
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6464
     this method may be redefined in subclasses"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6465
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6466
    ^ self basicSize
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6467
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6468
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6469
species
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6470
    "return a class which is similar to (or the same as) the receivers class.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6471
     This is used to create an appropriate object when creating derived
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6472
     copies in the collection classes (sometimes redefined)."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6473
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6474
    ^ self class
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6475
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6476
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6477
yourself
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6478
    "return the receiver - used for cascades to return self at the end"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6479
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6480
    ^ self
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6481
! !
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6482
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6483
!Object methodsFor:'secure message sending'!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6484
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6485
askFor:aSelector
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6486
    "try to send the receiver the message, aSelector.
4322
ae629533c1ef in #perform:ifNotUnderstood: - reject if the bad selector
Claus Gittinger <cg@exept.de>
parents: 4287
diff changeset
  6487
     If it does not understand it, return false. 
ae629533c1ef in #perform:ifNotUnderstood: - reject if the bad selector
Claus Gittinger <cg@exept.de>
parents: 4287
diff changeset
  6488
     Otherwise the real value returned.
ae629533c1ef in #perform:ifNotUnderstood: - reject if the bad selector
Claus Gittinger <cg@exept.de>
parents: 4287
diff changeset
  6489
     Useful to send messages such as: #isColor to unknown
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6490
     receivers."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6491
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6492
    ^ self perform:aSelector ifNotUnderstood:[false]
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6493
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6494
    "
4322
ae629533c1ef in #perform:ifNotUnderstood: - reject if the bad selector
Claus Gittinger <cg@exept.de>
parents: 4287
diff changeset
  6495
     1 askFor:#isColor     
ae629533c1ef in #perform:ifNotUnderstood: - reject if the bad selector
Claus Gittinger <cg@exept.de>
parents: 4287
diff changeset
  6496
     Color red askFor:#isColor 
ae629533c1ef in #perform:ifNotUnderstood: - reject if the bad selector
Claus Gittinger <cg@exept.de>
parents: 4287
diff changeset
  6497
ae629533c1ef in #perform:ifNotUnderstood: - reject if the bad selector
Claus Gittinger <cg@exept.de>
parents: 4287
diff changeset
  6498
     1 askFor:#isFoo     
ae629533c1ef in #perform:ifNotUnderstood: - reject if the bad selector
Claus Gittinger <cg@exept.de>
parents: 4287
diff changeset
  6499
     Color red askFor:#isFoo 
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6500
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6501
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6502
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6503
perform:aSelector ifNotUnderstood:exceptionBlock
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6504
    "try to send message aSelector to the receiver.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6505
     If its understood, return the methods returned value,
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6506
     otherwise return the value of the exceptionBlock"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6507
3994
e156620a43df slightly tuned #perform:ifNotUnderstood: methods.
Claus Gittinger <cg@exept.de>
parents: 3961
diff changeset
  6508
    |val ok|
e156620a43df slightly tuned #perform:ifNotUnderstood: methods.
Claus Gittinger <cg@exept.de>
parents: 3961
diff changeset
  6509
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6510
    MessageNotUnderstoodSignal handle:[:ex |
4322
ae629533c1ef in #perform:ifNotUnderstood: - reject if the bad selector
Claus Gittinger <cg@exept.de>
parents: 4287
diff changeset
  6511
        "/ reject, if the bad message is not the one
ae629533c1ef in #perform:ifNotUnderstood: - reject if the bad selector
Claus Gittinger <cg@exept.de>
parents: 4287
diff changeset
  6512
        "/ we have sent originally
ae629533c1ef in #perform:ifNotUnderstood: - reject if the bad selector
Claus Gittinger <cg@exept.de>
parents: 4287
diff changeset
  6513
        ex parameter selector == aSelector ifFalse:[
ae629533c1ef in #perform:ifNotUnderstood: - reject if the bad selector
Claus Gittinger <cg@exept.de>
parents: 4287
diff changeset
  6514
            ex reject
ae629533c1ef in #perform:ifNotUnderstood: - reject if the bad selector
Claus Gittinger <cg@exept.de>
parents: 4287
diff changeset
  6515
        ]
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6516
    ] do:[
3994
e156620a43df slightly tuned #perform:ifNotUnderstood: methods.
Claus Gittinger <cg@exept.de>
parents: 3961
diff changeset
  6517
        val := self perform:aSelector.
e156620a43df slightly tuned #perform:ifNotUnderstood: methods.
Claus Gittinger <cg@exept.de>
parents: 3961
diff changeset
  6518
        ok := true.
e156620a43df slightly tuned #perform:ifNotUnderstood: methods.
Claus Gittinger <cg@exept.de>
parents: 3961
diff changeset
  6519
    ].
e156620a43df slightly tuned #perform:ifNotUnderstood: methods.
Claus Gittinger <cg@exept.de>
parents: 3961
diff changeset
  6520
    ok isNil ifTrue:[
e156620a43df slightly tuned #perform:ifNotUnderstood: methods.
Claus Gittinger <cg@exept.de>
parents: 3961
diff changeset
  6521
        ^ exceptionBlock value
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6522
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6523
    ^ val
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6524
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6525
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6526
     1.2345 perform:#foo ifNotUnderstood:['sorry'] 
3994
e156620a43df slightly tuned #perform:ifNotUnderstood: methods.
Claus Gittinger <cg@exept.de>
parents: 3961
diff changeset
  6527
     1.2345 perform:#sqrt ifNotUnderstood:['sorry'] 
e156620a43df slightly tuned #perform:ifNotUnderstood: methods.
Claus Gittinger <cg@exept.de>
parents: 3961
diff changeset
  6528
     12345 perform:#sqrt ifNotUnderstood:['sorry']  
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6529
    "
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  6530
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
  6531
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6532
perform:aSelector with:argument ifNotUnderstood:exceptionBlock
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6533
    "try to send message aSelector to the receiver.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6534
     If its understood, return the methods returned value,
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6535
     otherwise return the value of the exceptionBlock"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6536
3994
e156620a43df slightly tuned #perform:ifNotUnderstood: methods.
Claus Gittinger <cg@exept.de>
parents: 3961
diff changeset
  6537
    |val ok|
e156620a43df slightly tuned #perform:ifNotUnderstood: methods.
Claus Gittinger <cg@exept.de>
parents: 3961
diff changeset
  6538
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6539
    MessageNotUnderstoodSignal handle:[:ex |
4322
ae629533c1ef in #perform:ifNotUnderstood: - reject if the bad selector
Claus Gittinger <cg@exept.de>
parents: 4287
diff changeset
  6540
        "/ reject, if the bad message is not the one
ae629533c1ef in #perform:ifNotUnderstood: - reject if the bad selector
Claus Gittinger <cg@exept.de>
parents: 4287
diff changeset
  6541
        "/ we have sent originally
ae629533c1ef in #perform:ifNotUnderstood: - reject if the bad selector
Claus Gittinger <cg@exept.de>
parents: 4287
diff changeset
  6542
        ex parameter selector == aSelector ifFalse:[
ae629533c1ef in #perform:ifNotUnderstood: - reject if the bad selector
Claus Gittinger <cg@exept.de>
parents: 4287
diff changeset
  6543
            ex reject
ae629533c1ef in #perform:ifNotUnderstood: - reject if the bad selector
Claus Gittinger <cg@exept.de>
parents: 4287
diff changeset
  6544
        ]
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6545
    ] do:[
3994
e156620a43df slightly tuned #perform:ifNotUnderstood: methods.
Claus Gittinger <cg@exept.de>
parents: 3961
diff changeset
  6546
        val := self perform:aSelector with:argument.
e156620a43df slightly tuned #perform:ifNotUnderstood: methods.
Claus Gittinger <cg@exept.de>
parents: 3961
diff changeset
  6547
        ok := true.
e156620a43df slightly tuned #perform:ifNotUnderstood: methods.
Claus Gittinger <cg@exept.de>
parents: 3961
diff changeset
  6548
    ].
e156620a43df slightly tuned #perform:ifNotUnderstood: methods.
Claus Gittinger <cg@exept.de>
parents: 3961
diff changeset
  6549
    ok isNil ifTrue:[
e156620a43df slightly tuned #perform:ifNotUnderstood: methods.
Claus Gittinger <cg@exept.de>
parents: 3961
diff changeset
  6550
        ^ exceptionBlock value
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6551
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6552
    ^ val
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6553
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6554
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6555
     |unknown|
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6556
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6557
     unknown := 1.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6558
     (unknown perform:#+ with:2 ifNotUnderstood:['sorry']) printNewline.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6559
     unknown := 'high there'.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6560
     (unknown perform:#+ with:2 ifNotUnderstood:['sorry']) printNewline.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6561
    "
2506
255c87b6fb4f added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents: 2505
diff changeset
  6562
!
255c87b6fb4f added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents: 2505
diff changeset
  6563
255c87b6fb4f added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents: 2505
diff changeset
  6564
perform:aSelector withArguments:argumentArray ifNotUnderstood:exceptionBlock
255c87b6fb4f added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents: 2505
diff changeset
  6565
    "try to send message aSelector to the receiver.
255c87b6fb4f added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents: 2505
diff changeset
  6566
     If its understood, return the methods returned value,
255c87b6fb4f added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents: 2505
diff changeset
  6567
     otherwise return the value of the exceptionBlock"
255c87b6fb4f added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents: 2505
diff changeset
  6568
3994
e156620a43df slightly tuned #perform:ifNotUnderstood: methods.
Claus Gittinger <cg@exept.de>
parents: 3961
diff changeset
  6569
    |val ok|
e156620a43df slightly tuned #perform:ifNotUnderstood: methods.
Claus Gittinger <cg@exept.de>
parents: 3961
diff changeset
  6570
2506
255c87b6fb4f added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents: 2505
diff changeset
  6571
    MessageNotUnderstoodSignal handle:[:ex |
4322
ae629533c1ef in #perform:ifNotUnderstood: - reject if the bad selector
Claus Gittinger <cg@exept.de>
parents: 4287
diff changeset
  6572
        "/ reject, if the bad message is not the one
ae629533c1ef in #perform:ifNotUnderstood: - reject if the bad selector
Claus Gittinger <cg@exept.de>
parents: 4287
diff changeset
  6573
        "/ we have sent originally
ae629533c1ef in #perform:ifNotUnderstood: - reject if the bad selector
Claus Gittinger <cg@exept.de>
parents: 4287
diff changeset
  6574
        ex parameter selector == aSelector ifFalse:[
ae629533c1ef in #perform:ifNotUnderstood: - reject if the bad selector
Claus Gittinger <cg@exept.de>
parents: 4287
diff changeset
  6575
            ex reject
ae629533c1ef in #perform:ifNotUnderstood: - reject if the bad selector
Claus Gittinger <cg@exept.de>
parents: 4287
diff changeset
  6576
        ]
2506
255c87b6fb4f added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents: 2505
diff changeset
  6577
    ] do:[
3994
e156620a43df slightly tuned #perform:ifNotUnderstood: methods.
Claus Gittinger <cg@exept.de>
parents: 3961
diff changeset
  6578
        val := self perform:aSelector withArguments:argumentArray.
e156620a43df slightly tuned #perform:ifNotUnderstood: methods.
Claus Gittinger <cg@exept.de>
parents: 3961
diff changeset
  6579
        ok := true.
e156620a43df slightly tuned #perform:ifNotUnderstood: methods.
Claus Gittinger <cg@exept.de>
parents: 3961
diff changeset
  6580
    ].
e156620a43df slightly tuned #perform:ifNotUnderstood: methods.
Claus Gittinger <cg@exept.de>
parents: 3961
diff changeset
  6581
    ok isNil ifTrue:[
e156620a43df slightly tuned #perform:ifNotUnderstood: methods.
Claus Gittinger <cg@exept.de>
parents: 3961
diff changeset
  6582
        ^ exceptionBlock value
2506
255c87b6fb4f added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents: 2505
diff changeset
  6583
    ].
255c87b6fb4f added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents: 2505
diff changeset
  6584
    ^ val
255c87b6fb4f added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents: 2505
diff changeset
  6585
255c87b6fb4f added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents: 2505
diff changeset
  6586
    "
255c87b6fb4f added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents: 2505
diff changeset
  6587
     |unknown|
255c87b6fb4f added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents: 2505
diff changeset
  6588
255c87b6fb4f added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents: 2505
diff changeset
  6589
     unknown := 1.
255c87b6fb4f added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents: 2505
diff changeset
  6590
     (unknown perform:#+ withArguments:#(2) ifNotUnderstood:['sorry']) printNewline.
255c87b6fb4f added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents: 2505
diff changeset
  6591
     unknown := 'high there'.
255c87b6fb4f added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents: 2505
diff changeset
  6592
     (unknown perform:#+ withArguments:#(2) ifNotUnderstood:['sorry']) printNewline.
255c87b6fb4f added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents: 2505
diff changeset
  6593
    "
255c87b6fb4f added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents: 2505
diff changeset
  6594
255c87b6fb4f added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents: 2505
diff changeset
  6595
    "Modified: 27.3.1997 / 14:13:16 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6596
! !
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6597
2448
ab70ff46b982 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2445
diff changeset
  6598
!Object methodsFor:'signal constants'!
ab70ff46b982 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2445
diff changeset
  6599
ab70ff46b982 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2445
diff changeset
  6600
messageNotUnderstoodSignal
ab70ff46b982 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2445
diff changeset
  6601
    ^ MessageNotUnderstoodSignal
ab70ff46b982 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2445
diff changeset
  6602
ab70ff46b982 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2445
diff changeset
  6603
    "Created: 6.3.1997 / 15:46:52 / cg"
ab70ff46b982 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2445
diff changeset
  6604
! !
ab70ff46b982 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2445
diff changeset
  6605
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6606
!Object methodsFor:'special queries'!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6607
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6608
allOwners
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6609
    "return a collection of all objects referencing the receiver"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6610
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6611
    ^ ObjectMemory whoReferences:self
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6612
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6613
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6614
references:anObject
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6615
    "return true, if the receiver refers to the argument, anObject.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6616
     - for debugging only"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6617
1109
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  6618
%{  /* NOCONTEXT */
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  6619
    OBJ cls, flags;
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  6620
    int nInsts, i;
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  6621
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  6622
    if (! __isNonNilObject(self)) {
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6623
        RETURN (false);
1109
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  6624
    }
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  6625
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6626
    /*
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6627
     * a little optimization: use the fact that all old objects
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6628
     * refering to a new object are on the remSet; if I am not,
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6629
     * a trivial reject is possible, if anObject is a newbee
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6630
     */
1109
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  6631
    if (__isNonNilObject(anObject)) {
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6632
        if ((__qSpace(self) <= OLDSPACE) && !__isRemembered(self)) {
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6633
            int spc;
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6634
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6635
            if (((spc = __qSpace(anObject)) == NEWSPACE) || (spc == SURVSPACE)) {
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6636
                RETURN (false);
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6637
            }
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6638
        }
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6639
    }
1109
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  6640
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  6641
    cls = __qClass(self);
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  6642
    if (cls == anObject) {
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6643
        RETURN (true);
1109
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  6644
    }
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  6645
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  6646
    flags = __ClassInstPtr(cls)->c_flags;
1386
a31cecccdfd8 _MASKSMALLINT -> __MASKSMALLINT;
Claus Gittinger <cg@exept.de>
parents: 1377
diff changeset
  6647
    if (((INT)flags & __MASKSMALLINT(ARRAYMASK)) == __MASKSMALLINT(POINTERARRAY)) {
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6648
        nInsts = __BYTES2OBJS__(__qSize(self) - OHDR_SIZE);
1109
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  6649
    } else {
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6650
        nInsts = __intVal(__ClassInstPtr(cls)->c_ninstvars);
1109
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  6651
    }
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  6652
    if (! nInsts) {
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6653
        RETURN (false);
1109
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  6654
    }
3259
ead60aee4cd3 tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents: 3254
diff changeset
  6655
#if defined(memsrch4)
ead60aee4cd3 tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents: 3254
diff changeset
  6656
    if (memsrch4(__InstPtr(self)->i_instvars, (INT)anObject, nInsts)) {
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6657
        RETURN (true);
3259
ead60aee4cd3 tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents: 3254
diff changeset
  6658
    }
ead60aee4cd3 tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents: 3254
diff changeset
  6659
#else
1109
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  6660
    for (i=0; i<nInsts; i++) {
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6661
        if (__InstPtr(self)->i_instvars[i] == anObject) {
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6662
            RETURN (true);
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6663
        }
1109
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  6664
    }
3259
ead60aee4cd3 tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents: 3254
diff changeset
  6665
#endif /* memsrch4 */
ead60aee4cd3 tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents: 3254
diff changeset
  6666
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6667
%}.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6668
3259
ead60aee4cd3 tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents: 3254
diff changeset
  6669
"/    |myClass 
ead60aee4cd3 tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents: 3254
diff changeset
  6670
"/     numInst "{ Class: SmallInteger }" |
ead60aee4cd3 tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents: 3254
diff changeset
  6671
"/
1109
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  6672
"/    myClass := self class.
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  6673
"/
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  6674
"/    "check the class"
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  6675
"/    (myClass == anObject) ifTrue:[^ true].
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  6676
"/
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  6677
"/    "check the instance variables"
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  6678
"/    numInst := myClass instSize.
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  6679
"/    1 to:numInst do:[:i | 
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6680
"/      ((self instVarAt:i) == anObject) ifTrue:[^ true]
1109
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  6681
"/    ].
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  6682
"/
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  6683
"/    "check the indexed variables"
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  6684
"/    myClass isVariable ifTrue:[
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6685
"/      myClass isPointers ifFalse:[
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6686
"/          "/
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6687
"/          "/ we could argue about the following unconditional return:
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6688
"/          "/ it says that a non pointer array never has a reference to the
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6689
"/          "/ corresponding object - not mimicing a reference to a copy of the
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6690
"/          "/ integer. However, it avoids useless searches in huge byteArray
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6691
"/          "/ like objects when searching for owners. If in doubt, remove it.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6692
"/          "/ A consequence of the return below is that #[1 2 3] will say that it
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6693
"/          "/ does not refer to the number 2 (think of keeping a copy instead)
1109
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  6694
"/
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6695
"/          ^ false.
1109
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  6696
"/
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6697
"/          "/ alternative:
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6698
"/          "/  anObject isNumber ifFalse:[^ false].
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6699
"/      ].
1109
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  6700
"/
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6701
"/      "/
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6702
"/      "/ because arrays are so common, and those have a highly tuned
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6703
"/      "/ idenitytIndex method, use it
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6704
"/      "/
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6705
"/      myClass == Array ifTrue:[
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6706
"/          ^ (self identityIndexOf:anObject) ~~ 0
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6707
"/      ].
1109
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  6708
"/
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6709
"/      "/
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6710
"/      "/ otherwise, do it the slow way
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6711
"/      "/
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6712
"/      numInst := self basicSize.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6713
"/      1 to:numInst do:[:i | 
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6714
"/          ((self basicAt:i) == anObject) ifTrue:[^ true]
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6715
"/      ]
1109
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  6716
"/    ].
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  6717
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6718
    ^ false
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6719
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6720
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6721
     |v|
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6722
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6723
     v := View new initialize.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6724
     v references:Display. 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6725
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6726
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6727
3259
ead60aee4cd3 tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents: 3254
diff changeset
  6728
referencesAny:aCollection
ead60aee4cd3 tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents: 3254
diff changeset
  6729
    "return true, if the receiver refers to any object from 
ead60aee4cd3 tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents: 3254
diff changeset
  6730
     the argument, aCollection.
ead60aee4cd3 tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents: 3254
diff changeset
  6731
     - for debugging only"
ead60aee4cd3 tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents: 3254
diff changeset
  6732
ead60aee4cd3 tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents: 3254
diff changeset
  6733
%{  
ead60aee4cd3 tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents: 3254
diff changeset
  6734
    OBJ cls, flags;
ead60aee4cd3 tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents: 3254
diff changeset
  6735
    int nInsts, inst;
ead60aee4cd3 tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents: 3254
diff changeset
  6736
ead60aee4cd3 tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents: 3254
diff changeset
  6737
    if (! __isNonNilObject(self)) {
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6738
        RETURN (false);
3259
ead60aee4cd3 tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents: 3254
diff changeset
  6739
    }
ead60aee4cd3 tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents: 3254
diff changeset
  6740
ead60aee4cd3 tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents: 3254
diff changeset
  6741
    if (__isArray(aCollection)) {
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6742
        int nObjs = __arraySize(aCollection);
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6743
        char *minAddr = 0, *maxAddr = 0;
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6744
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6745
        if (nObjs == 0) {
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6746
            RETURN (false);
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6747
        }
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6748
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6749
        /*
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6750
         * a little optimization: use the fact that all old objects
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6751
         * refering to a new object are on the remSet; if I am not,
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6752
         * a trivial reject is possible, if all objects are newbees.
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6753
         * as a side effect, gather min/max addresses
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6754
         */
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6755
        if ((__qSpace(self) <= OLDSPACE) && !__isRemembered(self)) {
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6756
            int allNewBees = 1;
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6757
            int i;
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6758
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6759
            minAddr = (char *)(__ArrayInstPtr(aCollection)->a_element[0]);
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6760
            maxAddr = minAddr;
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6761
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6762
            for (i=0; i<nObjs; i++) {
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6763
                OBJ anObject;
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6764
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6765
                anObject = __ArrayInstPtr(aCollection)->a_element[i];
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6766
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6767
                if (__isNonNilObject(anObject)) {
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6768
                    int spc;
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6769
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6770
                    if (((spc = __qSpace(anObject)) != NEWSPACE) && (spc != SURVSPACE)) {
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6771
                        allNewBees = 0;
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6772
                    }
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6773
                }
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6774
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6775
                if ((char *)anObject < minAddr) {
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6776
                    minAddr = (char *)anObject;
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6777
                } else if ((char *)anObject > maxAddr) {
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6778
                    maxAddr = (char *)anObject;
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6779
                }
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6780
            }
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6781
            if (allNewBees) {
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6782
                RETURN (false);
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6783
            }
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6784
        }
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6785
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6786
        /*
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6787
         * fetch min/max in searchList (if not already done)
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6788
         */
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6789
        if (minAddr == 0) {
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6790
            int i;
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6791
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6792
            for (i=0; i<nObjs; i++) {
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6793
                OBJ anObject;
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6794
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6795
                anObject = __ArrayInstPtr(aCollection)->a_element[i];
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6796
                if ((char *)anObject < minAddr) {
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6797
                    minAddr = (char *)anObject;
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6798
                } else if ((char *)anObject > maxAddr) {
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6799
                    maxAddr = (char *)anObject;
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6800
                }
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6801
            }
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6802
        }
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6803
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6804
        cls = __qClass(self);
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6805
        if (((char *)cls >= minAddr) && ((char *)cls <= maxAddr)) {
3259
ead60aee4cd3 tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents: 3254
diff changeset
  6806
#if defined(memsrch4)
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6807
            if (memsrch4(__ArrayInstPtr(aCollection)->a_element, (INT)cls, nObjs)) {
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6808
                RETURN (true);
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6809
            }
3259
ead60aee4cd3 tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents: 3254
diff changeset
  6810
#else
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6811
            int i;
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6812
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6813
            for (i=0; i<nObjs; i++) {
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6814
                OBJ anObject;
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6815
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6816
                anObject = __ArrayInstPtr(aCollection)->a_element[i];
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6817
                if (cls == anObject) {
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6818
                    RETURN (true);
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6819
                }
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6820
            }
3259
ead60aee4cd3 tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents: 3254
diff changeset
  6821
#endif /* memsrch4 */
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6822
        }
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6823
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6824
        flags = __ClassInstPtr(cls)->c_flags;
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6825
        if (((INT)flags & __MASKSMALLINT(ARRAYMASK)) == __MASKSMALLINT(POINTERARRAY)) {
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6826
            nInsts = __BYTES2OBJS__(__qSize(self) - OHDR_SIZE);
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6827
        } else {
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6828
            nInsts = __intVal(__ClassInstPtr(cls)->c_ninstvars);
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6829
        }
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6830
        if (! nInsts) {
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6831
            RETURN (false);
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6832
        }
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6833
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6834
        if (nObjs == 1) {
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6835
            /* better reverse the loop */
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6836
            OBJ anObject;
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6837
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6838
            anObject = __ArrayInstPtr(aCollection)->a_element[0];
3259
ead60aee4cd3 tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents: 3254
diff changeset
  6839
#if defined(memsrch4)
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6840
            if (memsrch4(__InstPtr(self)->i_instvars, (INT)anObject, nInsts)) {
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6841
                RETURN (true);
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6842
            }
3259
ead60aee4cd3 tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents: 3254
diff changeset
  6843
#else
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6844
            for (inst=0; inst<nInsts; inst++) {
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6845
                if ((__InstPtr(self)->i_instvars[inst]) == anObject) {
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6846
                    RETURN (true);
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6847
                }
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6848
            }
3694
429ec70365a6 tuned #referencesAny (for ref-chain search)
Claus Gittinger <cg@exept.de>
parents: 3622
diff changeset
  6849
#endif
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6850
            RETURN (false);
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6851
        }
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6852
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6853
        for (inst=0; inst<nInsts; inst++) {
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6854
            OBJ instVar = __InstPtr(self)->i_instvars[inst];
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6855
            int i;
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6856
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6857
            if (((char *)instVar >= minAddr) && ((char *)instVar <= maxAddr)) {
3694
429ec70365a6 tuned #referencesAny (for ref-chain search)
Claus Gittinger <cg@exept.de>
parents: 3622
diff changeset
  6858
#if defined(memsrch4)
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6859
                if (memsrch4(__ArrayInstPtr(aCollection)->a_element, (INT)instVar, nObjs)) {
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6860
                    RETURN (true);
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6861
                }
3694
429ec70365a6 tuned #referencesAny (for ref-chain search)
Claus Gittinger <cg@exept.de>
parents: 3622
diff changeset
  6862
#else
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6863
                for (i=0; i<nObjs; i++) {
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6864
                    OBJ anObject;
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6865
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6866
                    anObject = __ArrayInstPtr(aCollection)->a_element[i];
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6867
                    if (instVar == anObject) {
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6868
                        RETURN (true);
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6869
                    }
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6870
                }
3259
ead60aee4cd3 tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents: 3254
diff changeset
  6871
#endif /* memsrch4 */
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6872
            }
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6873
        }
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6874
        RETURN (false);
3259
ead60aee4cd3 tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents: 3254
diff changeset
  6875
    }
ead60aee4cd3 tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents: 3254
diff changeset
  6876
%}.
ead60aee4cd3 tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents: 3254
diff changeset
  6877
ead60aee4cd3 tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents: 3254
diff changeset
  6878
    aCollection do:[:el |
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6879
        (self references:el) ifTrue:[^ true].
3259
ead60aee4cd3 tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents: 3254
diff changeset
  6880
    ].
ead60aee4cd3 tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents: 3254
diff changeset
  6881
    ^ false
ead60aee4cd3 tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents: 3254
diff changeset
  6882
!
ead60aee4cd3 tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents: 3254
diff changeset
  6883
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6884
referencesDerivedInstanceOf:aClass
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6885
    "return true, if the receiver refers to an instance of
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6886
     the argument, aClass or its subclass. This method exists
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6887
     to support searching for users of a class."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6888
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6889
    |myClass 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6890
     numInst "{ Class: SmallInteger }" |
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6891
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6892
    myClass := self class.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6893
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6894
    "check the class"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6895
    (myClass isKindOf:aClass) ifTrue:[^ true].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6896
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6897
    "check the instance variables"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6898
    numInst := myClass instSize.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6899
    1 to:numInst do:[:i | 
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6900
        ((self instVarAt:i) isKindOf:aClass) ifTrue:[^ true]
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6901
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6902
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6903
    "check the indexed variables"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6904
    myClass isVariable ifTrue:[
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6905
        myClass isPointers ifFalse:[
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6906
            "no need to search in non pointer fields"
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6907
            ((aClass == Number) or:[aClass isSubclassOf:Number]) ifFalse:[^ false].
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6908
        ].
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6909
        numInst := self basicSize.
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6910
        1 to:numInst do:[:i | 
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6911
            ((self basicAt:i) isKindOf:aClass) ifTrue:[^ true]
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6912
        ]
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6913
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6914
    ^ false
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6915
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6916
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6917
     (1 @ 3.4) referencesDerivedInstanceOf:Number  
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6918
     (1 @ 3.4) referencesDerivedInstanceOf:Array   
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6919
     View new initialize referencesDerivedInstanceOf:DeviceWorkstation  
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6920
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6921
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6922
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6923
referencesInstanceOf:aClass
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6924
    "return true, if the receiver refers to an instance of
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6925
     the argument, aClass.This method exists
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6926
     to support searching for users of a class."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6927
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6928
    |myClass 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6929
     numInst "{ Class: SmallInteger }" |
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6930
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6931
    myClass := self class.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6932
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6933
    "check the class"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6934
    (myClass isMemberOf:aClass) ifTrue:[^ true].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6935
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6936
    "check the instance variables"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6937
    numInst := myClass instSize.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6938
    1 to:numInst do:[:i | 
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6939
        ((self instVarAt:i) isMemberOf:aClass) ifTrue:[^ true]
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6940
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6941
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6942
    "check the indexed variables"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6943
    myClass isVariable ifTrue:[
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6944
        myClass isPointers ifFalse:[
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6945
            "no need to search in non-pointer indexed fields"
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6946
            myClass isLongs ifTrue:[
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6947
                (aClass == SmallInteger or:[aClass == LargeInteger]) ifFalse:[^ false].
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6948
            ] ifFalse:[
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6949
                myClass isFloatsOrDoubles ifTrue:[^ aClass == Float].
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6950
                ^ aClass == SmallInteger
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6951
            ]
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6952
        ].
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6953
        numInst := self basicSize.
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6954
        1 to:numInst do:[:i | 
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6955
            ((self basicAt:i) isMemberOf:aClass) ifTrue:[^ true]
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6956
        ]
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6957
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6958
    ^ false
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6959
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6960
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6961
     (1 @ 3.4) referencesInstanceOf:Float     
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6962
     (1 @ 3.4) referencesInstanceOf:Fraction    
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6963
     View new initialize referencesInstanceOf:(Display class)  
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6964
    "
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  6965
! !
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6966
2295
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  6967
!Object methodsFor:'synchronized evaluation'!
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  6968
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  6969
freeSynchronizationSemaphore    
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  6970
    "free synchronizationSemaphore. May be used, to save memory when
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  6971
     an object is no longer used synchronized."
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  6972
2342
4e72f4d7caf1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2341
diff changeset
  6973
    |sema|
2295
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  6974
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  6975
    sema := self synchronizationSemaphore.
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  6976
    sema notNil ifTrue:[
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6977
        sema wait.              "/ get lock
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  6978
        self synchronizationSemaphore:nil.
2295
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  6979
    ].
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  6980
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  6981
    "
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  6982
     self synchronized:[].
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  6983
     self synchronizationSemaphore.
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  6984
     self freeSynchronizationSemaphore.
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  6985
    "
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  6986
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  6987
    "Created: 28.1.1997 / 19:31:20 / stefan"
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  6988
    "Modified: 28.1.1997 / 19:47:55 / stefan"
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  6989
!
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  6990
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  6991
synchronizationSemaphore
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  6992
    "return the synchronization semaphore for myself.
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  6993
     subclasses may redefine"
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  6994
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  6995
    ^ SynchronizationSemaphores at:self ifAbsent:[].
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  6996
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  6997
    "
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  6998
      self synchronizationSemaphore
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  6999
    "
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  7000
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  7001
    "Modified: 28.1.1997 / 19:47:09 / stefan"
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  7002
!
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  7003
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  7004
synchronizationSemaphore:aSemaphore
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  7005
    "set the synchronisationSemaphore for myself.
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  7006
     subclasses may redefine this method"
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  7007
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  7008
    aSemaphore isNil ifTrue:[
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  7009
        "/ remove Semaphore
5424
3ffaef20cfd0 removeKey:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 5421
diff changeset
  7010
        SynchronizationSemaphores removeKey:self ifAbsent:nil.
2295
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  7011
    ] ifFalse:[
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  7012
        SynchronizationSemaphores at:self put:aSemaphore.
2295
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  7013
    ].
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  7014
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  7015
    "Modified: 28.1.1997 / 19:37:48 / stefan"
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  7016
!
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  7017
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  7018
synchronized:aBlock
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  7019
    "evaluate aBlock synchronized, i.e. use a monitor for this object"
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  7020
2412
f20a5b10e6ab Further optim. for #synchronized.
Stefan Vogel <sv@exept.de>
parents: 2359
diff changeset
  7021
    |sema blocked gotSema|
2327
90f4a4b737d9 synchronized
Claus Gittinger <cg@exept.de>
parents: 2296
diff changeset
  7022
90f4a4b737d9 synchronized
Claus Gittinger <cg@exept.de>
parents: 2296
diff changeset
  7023
    blocked := OperatingSystem blockInterrupts.
90f4a4b737d9 synchronized
Claus Gittinger <cg@exept.de>
parents: 2296
diff changeset
  7024
90f4a4b737d9 synchronized
Claus Gittinger <cg@exept.de>
parents: 2296
diff changeset
  7025
    "/ the following avoids creation of an additional
90f4a4b737d9 synchronized
Claus Gittinger <cg@exept.de>
parents: 2296
diff changeset
  7026
    "/ block in the common case
2295
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  7027
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  7028
    sema := self synchronizationSemaphore.
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  7029
    sema isNil ifTrue:[
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  7030
        "get a locked semaphore (with count = 0)"
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  7031
        sema := Semaphore new.  
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  7032
        self synchronizationSemaphore:sema.
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  7033
        blocked ifFalse:[OperatingSystem unblockInterrupts].
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  7034
        ^ aBlock valueNowOrOnUnwindDo:[sema signal].
2327
90f4a4b737d9 synchronized
Claus Gittinger <cg@exept.de>
parents: 2296
diff changeset
  7035
    ].
90f4a4b737d9 synchronized
Claus Gittinger <cg@exept.de>
parents: 2296
diff changeset
  7036
2412
f20a5b10e6ab Further optim. for #synchronized.
Stefan Vogel <sv@exept.de>
parents: 2359
diff changeset
  7037
    "
f20a5b10e6ab Further optim. for #synchronized.
Stefan Vogel <sv@exept.de>
parents: 2359
diff changeset
  7038
     Poll sema (never waits).
f20a5b10e6ab Further optim. for #synchronized.
Stefan Vogel <sv@exept.de>
parents: 2359
diff changeset
  7039
     Assuming that this is the common operation, this saves the creation
f20a5b10e6ab Further optim. for #synchronized.
Stefan Vogel <sv@exept.de>
parents: 2359
diff changeset
  7040
     of some blocks.
f20a5b10e6ab Further optim. for #synchronized.
Stefan Vogel <sv@exept.de>
parents: 2359
diff changeset
  7041
    "
f20a5b10e6ab Further optim. for #synchronized.
Stefan Vogel <sv@exept.de>
parents: 2359
diff changeset
  7042
    (sema waitWithTimeout:0) notNil ifTrue:[
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  7043
        blocked ifFalse:[OperatingSystem unblockInterrupts].
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  7044
        ^ aBlock valueNowOrOnUnwindDo:[sema signal].
2295
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  7045
    ].
2327
90f4a4b737d9 synchronized
Claus Gittinger <cg@exept.de>
parents: 2296
diff changeset
  7046
90f4a4b737d9 synchronized
Claus Gittinger <cg@exept.de>
parents: 2296
diff changeset
  7047
    [
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  7048
        gotSema := sema wait.
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  7049
        blocked ifFalse:[OperatingSystem unblockInterrupts].
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  7050
        ^ aBlock value.
2327
90f4a4b737d9 synchronized
Claus Gittinger <cg@exept.de>
parents: 2296
diff changeset
  7051
    ] valueNowOrOnUnwindDo:[
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  7052
        gotSema notNil ifTrue:[gotSema signal]
2327
90f4a4b737d9 synchronized
Claus Gittinger <cg@exept.de>
parents: 2296
diff changeset
  7053
    ].
2295
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  7054
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  7055
    "
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  7056
       [Object synchronized:[Delay waitForSeconds:2. Transcript showCR:'1']] fork.
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  7057
       [Object synchronized:[Delay waitForSeconds:2. Transcript showCR:'2']] fork.
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  7058
    "
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  7059
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  7060
    "Created: 28.1.1997 / 17:52:56 / stefan"
2327
90f4a4b737d9 synchronized
Claus Gittinger <cg@exept.de>
parents: 2296
diff changeset
  7061
    "Modified: 30.1.1997 / 13:38:54 / cg"
2412
f20a5b10e6ab Further optim. for #synchronized.
Stefan Vogel <sv@exept.de>
parents: 2359
diff changeset
  7062
    "Modified: 20.2.1997 / 09:43:35 / stefan"
2295
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  7063
! !
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  7064
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  7065
!Object methodsFor:'system primitives'!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  7066
1957
3988b7bd159b added #asOop.
Claus Gittinger <cg@exept.de>
parents: 1905
diff changeset
  7067
asOop
3988b7bd159b added #asOop.
Claus Gittinger <cg@exept.de>
parents: 1905
diff changeset
  7068
    "ST-80 compatibility:
3988b7bd159b added #asOop.
Claus Gittinger <cg@exept.de>
parents: 1905
diff changeset
  7069
     ST-80 returns an OOP-identity based number here (I guess: its address
3988b7bd159b added #asOop.
Claus Gittinger <cg@exept.de>
parents: 1905
diff changeset
  7070
     or index); since ST/X has no such thing, and the objects address cannot
3988b7bd159b added #asOop.
Claus Gittinger <cg@exept.de>
parents: 1905
diff changeset
  7071
     be used (since its changing over time), we return the objects identityHash 
3988b7bd159b added #asOop.
Claus Gittinger <cg@exept.de>
parents: 1905
diff changeset
  7072
     key, which provides (at least) some identity indication.
3988b7bd159b added #asOop.
Claus Gittinger <cg@exept.de>
parents: 1905
diff changeset
  7073
     However, notice that (in contrast to ST-80's #asOop), the identityHash
3988b7bd159b added #asOop.
Claus Gittinger <cg@exept.de>
parents: 1905
diff changeset
  7074
     key of two non-identical objects may be the same.
3988b7bd159b added #asOop.
Claus Gittinger <cg@exept.de>
parents: 1905
diff changeset
  7075
     You'd better not use it - especially do not misuse it."
3988b7bd159b added #asOop.
Claus Gittinger <cg@exept.de>
parents: 1905
diff changeset
  7076
3988b7bd159b added #asOop.
Claus Gittinger <cg@exept.de>
parents: 1905
diff changeset
  7077
    ^ self identityHash
3988b7bd159b added #asOop.
Claus Gittinger <cg@exept.de>
parents: 1905
diff changeset
  7078
3988b7bd159b added #asOop.
Claus Gittinger <cg@exept.de>
parents: 1905
diff changeset
  7079
    "Created: 9.11.1996 / 19:09:56 / cg"
3988b7bd159b added #asOop.
Claus Gittinger <cg@exept.de>
parents: 1905
diff changeset
  7080
    "Modified: 9.11.1996 / 19:16:04 / cg"
3988b7bd159b added #asOop.
Claus Gittinger <cg@exept.de>
parents: 1905
diff changeset
  7081
!
3988b7bd159b added #asOop.
Claus Gittinger <cg@exept.de>
parents: 1905
diff changeset
  7082
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  7083
become:anotherObject
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  7084
    "make all references to the receiver become references to anotherObject
859
a532cd2450dd added becomeSameAs:
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  7085
     and vice-versa. Notice the vice-versa; see #becomeSameAs: for a one-way become.
a532cd2450dd added becomeSameAs:
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  7086
     This can be a very dangerous operation - be warned.
861
2b4dc0a4f65a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 859
diff changeset
  7087
     In general, using #become: should be avoided if possible, since it may 
2b4dc0a4f65a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 859
diff changeset
  7088
     produce many strange effects (think of hashing in Sets, Dictionaries etc.).
2b4dc0a4f65a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 859
diff changeset
  7089
2b4dc0a4f65a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 859
diff changeset
  7090
     This may also be an expensive (i.e. slow) operation, 
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  7091
     since in the worst case, the whole memory has to be searched for 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  7092
     references to the two objects (although the primitive tries hard to
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  7093
     limit the search, for acceptable performance in most cases). 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  7094
     This method fails, if the receiver or the argument is a SmallInteger 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  7095
     or nil, or is a context of a living method (i.e. one that has not already 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  7096
     returned).
859
a532cd2450dd added becomeSameAs:
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  7097
     (notice that #become: is not used heavily by the system 
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  7098
      - the Collection-classes have been rewritten to not use it.)"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  7099
%{
1688
8a42db1eea60 removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents: 1685
diff changeset
  7100
    if (__primBecome(self, anotherObject)) {
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  7101
        RETURN ( self );
859
a532cd2450dd added becomeSameAs:
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  7102
    }
a532cd2450dd added becomeSameAs:
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  7103
%}.
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  7104
    self primitiveFailed
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  7105
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  7106
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  7107
becomeNil
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  7108
    "make all references to the receiver become nil - effectively getting
859
a532cd2450dd added becomeSameAs:
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  7109
     rid of the receiver. 
a532cd2450dd added becomeSameAs:
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  7110
     This can be a very dangerous operation - be warned.
a532cd2450dd added becomeSameAs:
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  7111
a532cd2450dd added becomeSameAs:
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  7112
     This may be an expensive (i.e. slow) operation.
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  7113
     The receiver may not be a SmallInteger or a context of a living method."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  7114
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  7115
%{
1688
8a42db1eea60 removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents: 1685
diff changeset
  7116
    if (__primBecomeNil(self)) {
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  7117
        RETURN ( nil );
859
a532cd2450dd added becomeSameAs:
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  7118
    }
a532cd2450dd added becomeSameAs:
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  7119
%}.
a532cd2450dd added becomeSameAs:
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  7120
    self primitiveFailed
a532cd2450dd added becomeSameAs:
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  7121
!
a532cd2450dd added becomeSameAs:
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  7122
a532cd2450dd added becomeSameAs:
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  7123
becomeSameAs:anotherObject
a532cd2450dd added becomeSameAs:
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  7124
    "make all references to the receiver become references to anotherObject
861
2b4dc0a4f65a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 859
diff changeset
  7125
     but NOT vice versa (as done in #become:).
859
a532cd2450dd added becomeSameAs:
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  7126
     This can be a very dangerous operation - be warned.
861
2b4dc0a4f65a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 859
diff changeset
  7127
     In general, using #become: should be avoided if possible, since it may 
2b4dc0a4f65a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 859
diff changeset
  7128
     produce many strange effects (think of hashing in Sets, Dictionaries etc.).
2b4dc0a4f65a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 859
diff changeset
  7129
2b4dc0a4f65a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 859
diff changeset
  7130
     This may also be an expensive (i.e. slow) operation,
859
a532cd2450dd added becomeSameAs:
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  7131
     since in the worst case, the whole memory has to be searched for
a532cd2450dd added becomeSameAs:
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  7132
     references to the two objects (although the primitive tries hard to
a532cd2450dd added becomeSameAs:
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  7133
     limit the search, for acceptable performance in most cases).
a532cd2450dd added becomeSameAs:
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  7134
     This method fails, if the receiver or the argument is a SmallInteger
a532cd2450dd added becomeSameAs:
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  7135
     or nil, or is a context of a living method (i.e. one that has not already returned)."
a532cd2450dd added becomeSameAs:
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  7136
%{
1688
8a42db1eea60 removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents: 1685
diff changeset
  7137
    if (__primBecomeSameAs(self, anotherObject)) {
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  7138
        RETURN ( self );
859
a532cd2450dd added becomeSameAs:
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  7139
    }
a532cd2450dd added becomeSameAs:
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  7140
%}.
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  7141
    self primitiveFailed
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  7142
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  7143
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  7144
changeClassTo:otherClass
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  7145
    "changes the class of the receiver to the argument, otherClass.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  7146
     This is only allowed (possible), if the receivers class and the argument
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  7147
     have the same structure (i.e. number of named instance variables and
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  7148
     type of indexed instance variables). 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  7149
     If the structures do not match, or any of the original class or new class
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  7150
     is UndefinedObject or a Smallinteger, a primitive error is triggered."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  7151
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  7152
    |myClass ok|
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  7153
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  7154
    "check for UndefinedObject/SmallInteger receiver or newClass"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  7155
%{
1133
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1129
diff changeset
  7156
    {
4363
f07f766dbb93 oops - changeClassTo: did not accept extended bit-indexed classes
Claus Gittinger <cg@exept.de>
parents: 4360
diff changeset
  7157
        OBJ other = otherClass;
f07f766dbb93 oops - changeClassTo: did not accept extended bit-indexed classes
Claus Gittinger <cg@exept.de>
parents: 4360
diff changeset
  7158
f07f766dbb93 oops - changeClassTo: did not accept extended bit-indexed classes
Claus Gittinger <cg@exept.de>
parents: 4360
diff changeset
  7159
        if (__isNonNilObject(self) 
f07f766dbb93 oops - changeClassTo: did not accept extended bit-indexed classes
Claus Gittinger <cg@exept.de>
parents: 4360
diff changeset
  7160
         && __isNonNilObject(other)
f07f766dbb93 oops - changeClassTo: did not accept extended bit-indexed classes
Claus Gittinger <cg@exept.de>
parents: 4360
diff changeset
  7161
         && (other != UndefinedObject)
f07f766dbb93 oops - changeClassTo: did not accept extended bit-indexed classes
Claus Gittinger <cg@exept.de>
parents: 4360
diff changeset
  7162
         && (other != SmallInteger)) {
f07f766dbb93 oops - changeClassTo: did not accept extended bit-indexed classes
Claus Gittinger <cg@exept.de>
parents: 4360
diff changeset
  7163
            ok = true;
f07f766dbb93 oops - changeClassTo: did not accept extended bit-indexed classes
Claus Gittinger <cg@exept.de>
parents: 4360
diff changeset
  7164
        } else {
f07f766dbb93 oops - changeClassTo: did not accept extended bit-indexed classes
Claus Gittinger <cg@exept.de>
parents: 4360
diff changeset
  7165
            ok = false;
f07f766dbb93 oops - changeClassTo: did not accept extended bit-indexed classes
Claus Gittinger <cg@exept.de>
parents: 4360
diff changeset
  7166
        }
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  7167
    }
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  7168
%}.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  7169
    ok ifTrue:[
4363
f07f766dbb93 oops - changeClassTo: did not accept extended bit-indexed classes
Claus Gittinger <cg@exept.de>
parents: 4360
diff changeset
  7170
        ok := false.
f07f766dbb93 oops - changeClassTo: did not accept extended bit-indexed classes
Claus Gittinger <cg@exept.de>
parents: 4360
diff changeset
  7171
        myClass := self class.
f07f766dbb93 oops - changeClassTo: did not accept extended bit-indexed classes
Claus Gittinger <cg@exept.de>
parents: 4360
diff changeset
  7172
        myClass flags == otherClass flags ifTrue:[
f07f766dbb93 oops - changeClassTo: did not accept extended bit-indexed classes
Claus Gittinger <cg@exept.de>
parents: 4360
diff changeset
  7173
            myClass instSize == otherClass instSize ifTrue:[
f07f766dbb93 oops - changeClassTo: did not accept extended bit-indexed classes
Claus Gittinger <cg@exept.de>
parents: 4360
diff changeset
  7174
                "same instance layout and types: its ok to do it"
f07f766dbb93 oops - changeClassTo: did not accept extended bit-indexed classes
Claus Gittinger <cg@exept.de>
parents: 4360
diff changeset
  7175
                ok := true.
f07f766dbb93 oops - changeClassTo: did not accept extended bit-indexed classes
Claus Gittinger <cg@exept.de>
parents: 4360
diff changeset
  7176
            ] ifFalse:[
f07f766dbb93 oops - changeClassTo: did not accept extended bit-indexed classes
Claus Gittinger <cg@exept.de>
parents: 4360
diff changeset
  7177
                myClass isPointers ifTrue:[
f07f766dbb93 oops - changeClassTo: did not accept extended bit-indexed classes
Claus Gittinger <cg@exept.de>
parents: 4360
diff changeset
  7178
                    myClass isVariable ifTrue:[
f07f766dbb93 oops - changeClassTo: did not accept extended bit-indexed classes
Claus Gittinger <cg@exept.de>
parents: 4360
diff changeset
  7179
                        ok := true
f07f766dbb93 oops - changeClassTo: did not accept extended bit-indexed classes
Claus Gittinger <cg@exept.de>
parents: 4360
diff changeset
  7180
                    ]
f07f766dbb93 oops - changeClassTo: did not accept extended bit-indexed classes
Claus Gittinger <cg@exept.de>
parents: 4360
diff changeset
  7181
                ]
f07f766dbb93 oops - changeClassTo: did not accept extended bit-indexed classes
Claus Gittinger <cg@exept.de>
parents: 4360
diff changeset
  7182
            ]
f07f766dbb93 oops - changeClassTo: did not accept extended bit-indexed classes
Claus Gittinger <cg@exept.de>
parents: 4360
diff changeset
  7183
        ] ifFalse:[
f07f766dbb93 oops - changeClassTo: did not accept extended bit-indexed classes
Claus Gittinger <cg@exept.de>
parents: 4360
diff changeset
  7184
            myClass isPointers ifTrue:[
f07f766dbb93 oops - changeClassTo: did not accept extended bit-indexed classes
Claus Gittinger <cg@exept.de>
parents: 4360
diff changeset
  7185
                "if newClass is a variable class, with instSize <= my instsize,
f07f766dbb93 oops - changeClassTo: did not accept extended bit-indexed classes
Claus Gittinger <cg@exept.de>
parents: 4360
diff changeset
  7186
                 we can do it (effectively mapping additional instvars into the
f07f766dbb93 oops - changeClassTo: did not accept extended bit-indexed classes
Claus Gittinger <cg@exept.de>
parents: 4360
diff changeset
  7187
                 variable part) - usefulness is questionable, though"
f07f766dbb93 oops - changeClassTo: did not accept extended bit-indexed classes
Claus Gittinger <cg@exept.de>
parents: 4360
diff changeset
  7188
f07f766dbb93 oops - changeClassTo: did not accept extended bit-indexed classes
Claus Gittinger <cg@exept.de>
parents: 4360
diff changeset
  7189
                otherClass isPointers ifTrue:[
f07f766dbb93 oops - changeClassTo: did not accept extended bit-indexed classes
Claus Gittinger <cg@exept.de>
parents: 4360
diff changeset
  7190
                    otherClass isVariable ifTrue:[
f07f766dbb93 oops - changeClassTo: did not accept extended bit-indexed classes
Claus Gittinger <cg@exept.de>
parents: 4360
diff changeset
  7191
                        otherClass instSize <= (myClass instSize + self basicSize) 
f07f766dbb93 oops - changeClassTo: did not accept extended bit-indexed classes
Claus Gittinger <cg@exept.de>
parents: 4360
diff changeset
  7192
                        ifTrue:[
f07f766dbb93 oops - changeClassTo: did not accept extended bit-indexed classes
Claus Gittinger <cg@exept.de>
parents: 4360
diff changeset
  7193
                            ok := true
f07f766dbb93 oops - changeClassTo: did not accept extended bit-indexed classes
Claus Gittinger <cg@exept.de>
parents: 4360
diff changeset
  7194
                        ]
f07f766dbb93 oops - changeClassTo: did not accept extended bit-indexed classes
Claus Gittinger <cg@exept.de>
parents: 4360
diff changeset
  7195
                    ] ifFalse:[
f07f766dbb93 oops - changeClassTo: did not accept extended bit-indexed classes
Claus Gittinger <cg@exept.de>
parents: 4360
diff changeset
  7196
                        otherClass instSize == (myClass instSize + self basicSize) 
f07f766dbb93 oops - changeClassTo: did not accept extended bit-indexed classes
Claus Gittinger <cg@exept.de>
parents: 4360
diff changeset
  7197
                        ifTrue:[
f07f766dbb93 oops - changeClassTo: did not accept extended bit-indexed classes
Claus Gittinger <cg@exept.de>
parents: 4360
diff changeset
  7198
                            ok := true
f07f766dbb93 oops - changeClassTo: did not accept extended bit-indexed classes
Claus Gittinger <cg@exept.de>
parents: 4360
diff changeset
  7199
                        ]
f07f766dbb93 oops - changeClassTo: did not accept extended bit-indexed classes
Claus Gittinger <cg@exept.de>
parents: 4360
diff changeset
  7200
                    ]
f07f766dbb93 oops - changeClassTo: did not accept extended bit-indexed classes
Claus Gittinger <cg@exept.de>
parents: 4360
diff changeset
  7201
                ] ifFalse:[
f07f766dbb93 oops - changeClassTo: did not accept extended bit-indexed classes
Claus Gittinger <cg@exept.de>
parents: 4360
diff changeset
  7202
                    "it does not make sense to convert pointers to bytes ..."
f07f766dbb93 oops - changeClassTo: did not accept extended bit-indexed classes
Claus Gittinger <cg@exept.de>
parents: 4360
diff changeset
  7203
                ]
f07f766dbb93 oops - changeClassTo: did not accept extended bit-indexed classes
Claus Gittinger <cg@exept.de>
parents: 4360
diff changeset
  7204
            ] ifFalse:[
f07f766dbb93 oops - changeClassTo: did not accept extended bit-indexed classes
Claus Gittinger <cg@exept.de>
parents: 4360
diff changeset
  7205
                "does it make sense, to convert bits ?"
f07f766dbb93 oops - changeClassTo: did not accept extended bit-indexed classes
Claus Gittinger <cg@exept.de>
parents: 4360
diff changeset
  7206
                "could allow byteArray->wordArray->longArray->floatArray->doubleArray here ..."
f07f766dbb93 oops - changeClassTo: did not accept extended bit-indexed classes
Claus Gittinger <cg@exept.de>
parents: 4360
diff changeset
  7207
                (myClass isBitsExtended and:[otherClass isBitsExtended]) ifTrue:[
f07f766dbb93 oops - changeClassTo: did not accept extended bit-indexed classes
Claus Gittinger <cg@exept.de>
parents: 4360
diff changeset
  7208
                    ok := true
f07f766dbb93 oops - changeClassTo: did not accept extended bit-indexed classes
Claus Gittinger <cg@exept.de>
parents: 4360
diff changeset
  7209
                ]
f07f766dbb93 oops - changeClassTo: did not accept extended bit-indexed classes
Claus Gittinger <cg@exept.de>
parents: 4360
diff changeset
  7210
            ]
f07f766dbb93 oops - changeClassTo: did not accept extended bit-indexed classes
Claus Gittinger <cg@exept.de>
parents: 4360
diff changeset
  7211
        ]
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  7212
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  7213
    ok ifTrue:[
4363
f07f766dbb93 oops - changeClassTo: did not accept extended bit-indexed classes
Claus Gittinger <cg@exept.de>
parents: 4360
diff changeset
  7214
        "now, change the receivers class ..."
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  7215
%{
4363
f07f766dbb93 oops - changeClassTo: did not accept extended bit-indexed classes
Claus Gittinger <cg@exept.de>
parents: 4360
diff changeset
  7216
        {
f07f766dbb93 oops - changeClassTo: did not accept extended bit-indexed classes
Claus Gittinger <cg@exept.de>
parents: 4360
diff changeset
  7217
            OBJ me = self;
f07f766dbb93 oops - changeClassTo: did not accept extended bit-indexed classes
Claus Gittinger <cg@exept.de>
parents: 4360
diff changeset
  7218
f07f766dbb93 oops - changeClassTo: did not accept extended bit-indexed classes
Claus Gittinger <cg@exept.de>
parents: 4360
diff changeset
  7219
            __qClass(me) = otherClass;
f07f766dbb93 oops - changeClassTo: did not accept extended bit-indexed classes
Claus Gittinger <cg@exept.de>
parents: 4360
diff changeset
  7220
            __STORE(me, otherClass);
f07f766dbb93 oops - changeClassTo: did not accept extended bit-indexed classes
Claus Gittinger <cg@exept.de>
parents: 4360
diff changeset
  7221
            RETURN (me);
f07f766dbb93 oops - changeClassTo: did not accept extended bit-indexed classes
Claus Gittinger <cg@exept.de>
parents: 4360
diff changeset
  7222
        }
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  7223
%}.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  7224
    ].
1022
f526a827ea1a allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  7225
f526a827ea1a allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  7226
    "
f526a827ea1a allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  7227
     the receiver cannot be represented as a instance of
f526a827ea1a allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  7228
     the desired class.
f526a827ea1a allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  7229
     For example, you cannot change a bitInstance (byteArray etc.) 
f526a827ea1a allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  7230
     into a pointer object and vice versa.
f526a827ea1a allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  7231
    "
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  7232
    self primitiveFailed
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  7233
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  7234
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  7235
changeClassToThatOf:anObject
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  7236
    "changes the class of the receiver to that of the argument, anObject.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  7237
     This is only allowed (possible), if the receivers class and the arguments
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  7238
     class have the same structure (i.e. number of named instance variables and 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  7239
     type of indexed instance variables). If the structures do not match, or any
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  7240
     of the objects is nil or a Smallinteger, a primitive error is triggered."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  7241
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  7242
    self changeClassTo:(anObject class)
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  7243
! !
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  7244
1867
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7245
!Object methodsFor:'testing'!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7246
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7247
? defaultValue
3465
1ba2cd91b1b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3464
diff changeset
  7248
     "a syntactic shugar-piece:
1ba2cd91b1b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3464
diff changeset
  7249
      if the receiver is nil, return the defaultValue;
1867
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7250
      otherwise, return the receiver.
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7251
      This method is only redefined in UndefinedObject - therefore,
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7252
      the recevier is retuned here.
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7253
1958
d8d575552c87 commentary
Claus Gittinger <cg@exept.de>
parents: 1957
diff changeset
  7254
      Thus, if foo and bar are simple variables or constants,
4360
41671bce2bd6 comments only
Claus Gittinger <cg@exept.de>
parents: 4339
diff changeset
  7255
          foo ? bar
1958
d8d575552c87 commentary
Claus Gittinger <cg@exept.de>
parents: 1957
diff changeset
  7256
      is the same as:
4360
41671bce2bd6 comments only
Claus Gittinger <cg@exept.de>
parents: 4339
diff changeset
  7257
          (foo isNil ifTrue:[bar] ifFalse:[foo])
1958
d8d575552c87 commentary
Claus Gittinger <cg@exept.de>
parents: 1957
diff changeset
  7258
d8d575552c87 commentary
Claus Gittinger <cg@exept.de>
parents: 1957
diff changeset
  7259
      if they are message sends, the equivalent code is:
4360
41671bce2bd6 comments only
Claus Gittinger <cg@exept.de>
parents: 4339
diff changeset
  7260
          [
41671bce2bd6 comments only
Claus Gittinger <cg@exept.de>
parents: 4339
diff changeset
  7261
              |t1 t2|
41671bce2bd6 comments only
Claus Gittinger <cg@exept.de>
parents: 4339
diff changeset
  7262
41671bce2bd6 comments only
Claus Gittinger <cg@exept.de>
parents: 4339
diff changeset
  7263
              t1 := foo.
41671bce2bd6 comments only
Claus Gittinger <cg@exept.de>
parents: 4339
diff changeset
  7264
              t2 := bar.
41671bce2bd6 comments only
Claus Gittinger <cg@exept.de>
parents: 4339
diff changeset
  7265
              t1 isNil ifTrue:[t2] ifFalse:[t1]
41671bce2bd6 comments only
Claus Gittinger <cg@exept.de>
parents: 4339
diff changeset
  7266
          ] value
1958
d8d575552c87 commentary
Claus Gittinger <cg@exept.de>
parents: 1957
diff changeset
  7267
1867
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7268
      Can be used to provide defaultValues to variables,
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7269
      as in:
4360
41671bce2bd6 comments only
Claus Gittinger <cg@exept.de>
parents: 4339
diff changeset
  7270
          foo := arg ? #defaultValue
2147
3579ce76c8c8 comment
Claus Gittinger <cg@exept.de>
parents: 2136
diff changeset
  7271
2148
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
  7272
      Note: this method should never be redefined in classes other than UndefinedObject.
4360
41671bce2bd6 comments only
Claus Gittinger <cg@exept.de>
parents: 4339
diff changeset
  7273
      Notice:
41671bce2bd6 comments only
Claus Gittinger <cg@exept.de>
parents: 4339
diff changeset
  7274
         This method is open coded (inlined) by the compiler(s)
41671bce2bd6 comments only
Claus Gittinger <cg@exept.de>
parents: 4339
diff changeset
  7275
         - redefining it may not work as expected."
1867
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7276
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7277
    ^ self
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7278
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7279
    "
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7280
     1 ? #default
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7281
     nil ? #default
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7282
    "
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7283
3465
1ba2cd91b1b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3464
diff changeset
  7284
    "Created: / 4.11.1996 / 20:36:19 / cg"
1ba2cd91b1b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3464
diff changeset
  7285
    "Modified: / 19.5.1998 / 17:39:56 / cg"
1867
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7286
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7287
3463
2df184db7eef added ?? - much like ?, but sends #value to its argument.
Claus Gittinger <cg@exept.de>
parents: 3450
diff changeset
  7288
?? defaultValue
3465
1ba2cd91b1b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3464
diff changeset
  7289
     "a syntactic shugar-piece:
4339
18c19912a67c added #ifNil and friends - squeak compatibility.
Claus Gittinger <cg@exept.de>
parents: 4322
diff changeset
  7290
      much like ?, but sends #value to the argument if required.
18c19912a67c added #ifNil and friends - squeak compatibility.
Claus Gittinger <cg@exept.de>
parents: 4322
diff changeset
  7291
      (i.e. its the same as #ifNil:)
3463
2df184db7eef added ?? - much like ?, but sends #value to its argument.
Claus Gittinger <cg@exept.de>
parents: 3450
diff changeset
  7292
      If the receiver is nil, return the defaultValues value;
2df184db7eef added ?? - much like ?, but sends #value to its argument.
Claus Gittinger <cg@exept.de>
parents: 3450
diff changeset
  7293
      otherwise, return the receiver.
2df184db7eef added ?? - much like ?, but sends #value to its argument.
Claus Gittinger <cg@exept.de>
parents: 3450
diff changeset
  7294
      This method is only redefined in UndefinedObject - therefore,
2df184db7eef added ?? - much like ?, but sends #value to its argument.
Claus Gittinger <cg@exept.de>
parents: 3450
diff changeset
  7295
      the recevier is retuned here.
2df184db7eef added ?? - much like ?, but sends #value to its argument.
Claus Gittinger <cg@exept.de>
parents: 3450
diff changeset
  7296
2df184db7eef added ?? - much like ?, but sends #value to its argument.
Claus Gittinger <cg@exept.de>
parents: 3450
diff changeset
  7297
      Thus, if foo and bar are simple variables or constants,
4339
18c19912a67c added #ifNil and friends - squeak compatibility.
Claus Gittinger <cg@exept.de>
parents: 4322
diff changeset
  7298
          foo ?? bar
3463
2df184db7eef added ?? - much like ?, but sends #value to its argument.
Claus Gittinger <cg@exept.de>
parents: 3450
diff changeset
  7299
      is the same as:
4339
18c19912a67c added #ifNil and friends - squeak compatibility.
Claus Gittinger <cg@exept.de>
parents: 4322
diff changeset
  7300
          (foo isNil ifTrue:[bar value] ifFalse:[foo])
3463
2df184db7eef added ?? - much like ?, but sends #value to its argument.
Claus Gittinger <cg@exept.de>
parents: 3450
diff changeset
  7301
2df184db7eef added ?? - much like ?, but sends #value to its argument.
Claus Gittinger <cg@exept.de>
parents: 3450
diff changeset
  7302
      if they are message sends, the equivalent code is:
4339
18c19912a67c added #ifNil and friends - squeak compatibility.
Claus Gittinger <cg@exept.de>
parents: 4322
diff changeset
  7303
          [
18c19912a67c added #ifNil and friends - squeak compatibility.
Claus Gittinger <cg@exept.de>
parents: 4322
diff changeset
  7304
              |t t2|
18c19912a67c added #ifNil and friends - squeak compatibility.
Claus Gittinger <cg@exept.de>
parents: 4322
diff changeset
  7305
18c19912a67c added #ifNil and friends - squeak compatibility.
Claus Gittinger <cg@exept.de>
parents: 4322
diff changeset
  7306
              t := foo.
18c19912a67c added #ifNil and friends - squeak compatibility.
Claus Gittinger <cg@exept.de>
parents: 4322
diff changeset
  7307
              t isNil ifTrue:[bar value] ifFalse:[t]
18c19912a67c added #ifNil and friends - squeak compatibility.
Claus Gittinger <cg@exept.de>
parents: 4322
diff changeset
  7308
          ] value
3463
2df184db7eef added ?? - much like ?, but sends #value to its argument.
Claus Gittinger <cg@exept.de>
parents: 3450
diff changeset
  7309
2df184db7eef added ?? - much like ?, but sends #value to its argument.
Claus Gittinger <cg@exept.de>
parents: 3450
diff changeset
  7310
      Can be used to provide defaultValues to variables,
2df184db7eef added ?? - much like ?, but sends #value to its argument.
Claus Gittinger <cg@exept.de>
parents: 3450
diff changeset
  7311
      as in:
4360
41671bce2bd6 comments only
Claus Gittinger <cg@exept.de>
parents: 4339
diff changeset
  7312
          foo := arg ?? [ self computeDefault ]
3463
2df184db7eef added ?? - much like ?, but sends #value to its argument.
Claus Gittinger <cg@exept.de>
parents: 3450
diff changeset
  7313
2df184db7eef added ?? - much like ?, but sends #value to its argument.
Claus Gittinger <cg@exept.de>
parents: 3450
diff changeset
  7314
      Note: this method should never be redefined in classes other than UndefinedObject.
2df184db7eef added ?? - much like ?, but sends #value to its argument.
Claus Gittinger <cg@exept.de>
parents: 3450
diff changeset
  7315
     "
2df184db7eef added ?? - much like ?, but sends #value to its argument.
Claus Gittinger <cg@exept.de>
parents: 3450
diff changeset
  7316
2df184db7eef added ?? - much like ?, but sends #value to its argument.
Claus Gittinger <cg@exept.de>
parents: 3450
diff changeset
  7317
    ^ self
2df184db7eef added ?? - much like ?, but sends #value to its argument.
Claus Gittinger <cg@exept.de>
parents: 3450
diff changeset
  7318
2df184db7eef added ?? - much like ?, but sends #value to its argument.
Claus Gittinger <cg@exept.de>
parents: 3450
diff changeset
  7319
    "
2df184db7eef added ?? - much like ?, but sends #value to its argument.
Claus Gittinger <cg@exept.de>
parents: 3450
diff changeset
  7320
     1 ?? #default 
2df184db7eef added ?? - much like ?, but sends #value to its argument.
Claus Gittinger <cg@exept.de>
parents: 3450
diff changeset
  7321
     nil ?? #default
4360
41671bce2bd6 comments only
Claus Gittinger <cg@exept.de>
parents: 4339
diff changeset
  7322
     1 ?? [ self halt. 1 + 2 ] 
41671bce2bd6 comments only
Claus Gittinger <cg@exept.de>
parents: 4339
diff changeset
  7323
     nil ?? [ self halt. 1 + 2 ] 
3463
2df184db7eef added ?? - much like ?, but sends #value to its argument.
Claus Gittinger <cg@exept.de>
parents: 3450
diff changeset
  7324
    "
2df184db7eef added ?? - much like ?, but sends #value to its argument.
Claus Gittinger <cg@exept.de>
parents: 3450
diff changeset
  7325
2df184db7eef added ?? - much like ?, but sends #value to its argument.
Claus Gittinger <cg@exept.de>
parents: 3450
diff changeset
  7326
    "Created: / 4.11.1996 / 20:36:19 / cg"
3466
f0ba47c6d90a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3465
diff changeset
  7327
    "Modified: / 19.5.1998 / 17:42:56 / cg"
3463
2df184db7eef added ?? - much like ?, but sends #value to its argument.
Claus Gittinger <cg@exept.de>
parents: 3450
diff changeset
  7328
!
2df184db7eef added ?? - much like ?, but sends #value to its argument.
Claus Gittinger <cg@exept.de>
parents: 3450
diff changeset
  7329
4339
18c19912a67c added #ifNil and friends - squeak compatibility.
Claus Gittinger <cg@exept.de>
parents: 4322
diff changeset
  7330
ifNil:aBlockOrValue
18c19912a67c added #ifNil and friends - squeak compatibility.
Claus Gittinger <cg@exept.de>
parents: 4322
diff changeset
  7331
    "return myself, or the result from evaluating the argument, if I am nil.
18c19912a67c added #ifNil and friends - squeak compatibility.
Claus Gittinger <cg@exept.de>
parents: 4322
diff changeset
  7332
     This is much like #?, but sends #value to the argument in case of a nil
4360
41671bce2bd6 comments only
Claus Gittinger <cg@exept.de>
parents: 4339
diff changeset
  7333
     receiver.
41671bce2bd6 comments only
Claus Gittinger <cg@exept.de>
parents: 4339
diff changeset
  7334
     Notice:
41671bce2bd6 comments only
Claus Gittinger <cg@exept.de>
parents: 4339
diff changeset
  7335
        This method is open coded (inlined) by the compiler(s)
41671bce2bd6 comments only
Claus Gittinger <cg@exept.de>
parents: 4339
diff changeset
  7336
        - redefining it may not work as expected."
4339
18c19912a67c added #ifNil and friends - squeak compatibility.
Claus Gittinger <cg@exept.de>
parents: 4322
diff changeset
  7337
18c19912a67c added #ifNil and friends - squeak compatibility.
Claus Gittinger <cg@exept.de>
parents: 4322
diff changeset
  7338
    ^ self
18c19912a67c added #ifNil and friends - squeak compatibility.
Claus Gittinger <cg@exept.de>
parents: 4322
diff changeset
  7339
!
18c19912a67c added #ifNil and friends - squeak compatibility.
Claus Gittinger <cg@exept.de>
parents: 4322
diff changeset
  7340
18c19912a67c added #ifNil and friends - squeak compatibility.
Claus Gittinger <cg@exept.de>
parents: 4322
diff changeset
  7341
ifNil:nilBlockOrValue ifNotNil:notNilBlockOrValue
18c19912a67c added #ifNil and friends - squeak compatibility.
Claus Gittinger <cg@exept.de>
parents: 4322
diff changeset
  7342
    "return the value of the first arg, if I am nil,
4360
41671bce2bd6 comments only
Claus Gittinger <cg@exept.de>
parents: 4339
diff changeset
  7343
     the result from evaluating the 2nd argument, if I am not nil.
41671bce2bd6 comments only
Claus Gittinger <cg@exept.de>
parents: 4339
diff changeset
  7344
     Notice:
41671bce2bd6 comments only
Claus Gittinger <cg@exept.de>
parents: 4339
diff changeset
  7345
        This method is open coded (inlined) by the compiler(s)
41671bce2bd6 comments only
Claus Gittinger <cg@exept.de>
parents: 4339
diff changeset
  7346
        - redefining it may not work as expected."
4339
18c19912a67c added #ifNil and friends - squeak compatibility.
Claus Gittinger <cg@exept.de>
parents: 4322
diff changeset
  7347
18c19912a67c added #ifNil and friends - squeak compatibility.
Claus Gittinger <cg@exept.de>
parents: 4322
diff changeset
  7348
    ^ notNilBlockOrValue value
18c19912a67c added #ifNil and friends - squeak compatibility.
Claus Gittinger <cg@exept.de>
parents: 4322
diff changeset
  7349
18c19912a67c added #ifNil and friends - squeak compatibility.
Claus Gittinger <cg@exept.de>
parents: 4322
diff changeset
  7350
!
18c19912a67c added #ifNil and friends - squeak compatibility.
Claus Gittinger <cg@exept.de>
parents: 4322
diff changeset
  7351
18c19912a67c added #ifNil and friends - squeak compatibility.
Claus Gittinger <cg@exept.de>
parents: 4322
diff changeset
  7352
ifNotNil:aBlockOrValue
4360
41671bce2bd6 comments only
Claus Gittinger <cg@exept.de>
parents: 4339
diff changeset
  7353
    "return myself if nil, or the result from evaluating the argument, 
41671bce2bd6 comments only
Claus Gittinger <cg@exept.de>
parents: 4339
diff changeset
  7354
     if I am not nil.
41671bce2bd6 comments only
Claus Gittinger <cg@exept.de>
parents: 4339
diff changeset
  7355
     Notice:
41671bce2bd6 comments only
Claus Gittinger <cg@exept.de>
parents: 4339
diff changeset
  7356
        This method is open coded (inlined) by the compiler(s)
41671bce2bd6 comments only
Claus Gittinger <cg@exept.de>
parents: 4339
diff changeset
  7357
        - redefining it may not work as expected."
4339
18c19912a67c added #ifNil and friends - squeak compatibility.
Claus Gittinger <cg@exept.de>
parents: 4322
diff changeset
  7358
18c19912a67c added #ifNil and friends - squeak compatibility.
Claus Gittinger <cg@exept.de>
parents: 4322
diff changeset
  7359
    ^ aBlockOrValue value
18c19912a67c added #ifNil and friends - squeak compatibility.
Claus Gittinger <cg@exept.de>
parents: 4322
diff changeset
  7360
18c19912a67c added #ifNil and friends - squeak compatibility.
Claus Gittinger <cg@exept.de>
parents: 4322
diff changeset
  7361
!
18c19912a67c added #ifNil and friends - squeak compatibility.
Claus Gittinger <cg@exept.de>
parents: 4322
diff changeset
  7362
18c19912a67c added #ifNil and friends - squeak compatibility.
Claus Gittinger <cg@exept.de>
parents: 4322
diff changeset
  7363
ifNotNil:notNilBlockOrValue ifNil:nilBlockOrValue
18c19912a67c added #ifNil and friends - squeak compatibility.
Claus Gittinger <cg@exept.de>
parents: 4322
diff changeset
  7364
    "return the value of the 2nd arg, if I am nil,
4360
41671bce2bd6 comments only
Claus Gittinger <cg@exept.de>
parents: 4339
diff changeset
  7365
     the result from evaluating the 1st argument, if I am not nil.
41671bce2bd6 comments only
Claus Gittinger <cg@exept.de>
parents: 4339
diff changeset
  7366
     Notice:
41671bce2bd6 comments only
Claus Gittinger <cg@exept.de>
parents: 4339
diff changeset
  7367
        This method is open coded (inlined) by the compiler(s)
41671bce2bd6 comments only
Claus Gittinger <cg@exept.de>
parents: 4339
diff changeset
  7368
        - redefining it may not work as expected."
4339
18c19912a67c added #ifNil and friends - squeak compatibility.
Claus Gittinger <cg@exept.de>
parents: 4322
diff changeset
  7369
18c19912a67c added #ifNil and friends - squeak compatibility.
Claus Gittinger <cg@exept.de>
parents: 4322
diff changeset
  7370
    ^ notNilBlockOrValue value
18c19912a67c added #ifNil and friends - squeak compatibility.
Claus Gittinger <cg@exept.de>
parents: 4322
diff changeset
  7371
18c19912a67c added #ifNil and friends - squeak compatibility.
Claus Gittinger <cg@exept.de>
parents: 4322
diff changeset
  7372
18c19912a67c added #ifNil and friends - squeak compatibility.
Claus Gittinger <cg@exept.de>
parents: 4322
diff changeset
  7373
!
18c19912a67c added #ifNil and friends - squeak compatibility.
Claus Gittinger <cg@exept.de>
parents: 4322
diff changeset
  7374
1867
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7375
isArray
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7376
    "return true, if the receiver is some kind of array (or weakArray etc);
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7377
     false is returned here - the method is only redefined in Array."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7378
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7379
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7380
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7381
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7382
isAssociation
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7383
    "return true, if the receiver is some kind of association;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7384
     false is returned here - the method is only redefined in Association."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7385
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7386
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7387
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7388
    "Created: 14.5.1996 / 17:03:45 / cg"
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7389
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7390
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7391
isBehavior
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7392
    "return true, if the receiver is some kind of class (i.e. behavior);
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7393
     false is returned here - the method is only redefined in Behavior."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7394
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7395
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7396
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7397
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7398
isBlock
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7399
    "return true, if the receiver is some kind of block;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7400
     false returned here - the method is only redefined in Block."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7401
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7402
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7403
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7404
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  7405
isByteArray
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  7406
    "return true, if the receiver is some kind of bytearray;
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  7407
     false is returned here - the method is only redefined in ByteArray."
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  7408
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  7409
    ^ false
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  7410
!
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  7411
1867
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7412
isCharacter
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7413
    "return true, if the receiver is some kind of character;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7414
     false is returned here - the method is only redefined in Character."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7415
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7416
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7417
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7418
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7419
isClass
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7420
    "return true, if the receiver is some kind of class (real class, 
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7421
     not just behavior);
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7422
     false is returned here - the method is only redefined in Class."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7423
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7424
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7425
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7426
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7427
isCollection
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7428
    "return true, if the receiver is some kind of collection;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7429
     false is returned here - the method is only redefined in Collection."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7430
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7431
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7432
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7433
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7434
isColor
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7435
    "return true, if the receiver is some kind of color;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7436
     false is returned here - the method is only redefined in Color."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7437
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7438
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7439
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7440
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7441
isContext
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7442
    "return true, if the receiver is some kind of context;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7443
     false returned here - the method is only redefined in Context."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7444
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7445
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7446
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7447
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7448
isExternalStream
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7449
    "return true, if the receiver is some kind of externalStream;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7450
     false is returned here - the method is only redefined in ExternalStream."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7451
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7452
    ^false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7453
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7454
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7455
isFileStream
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7456
    "return true, if the receiver is some kind of fileStream;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7457
     false is returned here - the method is only redefined in FileStream."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7458
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7459
    ^false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7460
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7461
5597
8a78f65b2df1 added isFilename query
Claus Gittinger <cg@exept.de>
parents: 5588
diff changeset
  7462
isFilename
8a78f65b2df1 added isFilename query
Claus Gittinger <cg@exept.de>
parents: 5588
diff changeset
  7463
    "return true, if the receiver is some kind of filename;
8a78f65b2df1 added isFilename query
Claus Gittinger <cg@exept.de>
parents: 5588
diff changeset
  7464
     false is returned here - the method is only redefined in Filename."
8a78f65b2df1 added isFilename query
Claus Gittinger <cg@exept.de>
parents: 5588
diff changeset
  7465
8a78f65b2df1 added isFilename query
Claus Gittinger <cg@exept.de>
parents: 5588
diff changeset
  7466
    ^false
8a78f65b2df1 added isFilename query
Claus Gittinger <cg@exept.de>
parents: 5588
diff changeset
  7467
!
8a78f65b2df1 added isFilename query
Claus Gittinger <cg@exept.de>
parents: 5588
diff changeset
  7468
1887
364cff2aec4e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1867
diff changeset
  7469
isFixedPoint
364cff2aec4e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1867
diff changeset
  7470
    "return true, if the receiver is some kind of fixedPoint number;
364cff2aec4e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1867
diff changeset
  7471
     false is returned here - the method is only redefined in FixedPoint."
364cff2aec4e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1867
diff changeset
  7472
364cff2aec4e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1867
diff changeset
  7473
    ^ false
364cff2aec4e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1867
diff changeset
  7474
364cff2aec4e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1867
diff changeset
  7475
    "Created: 5.11.1996 / 19:23:04 / cg"
364cff2aec4e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1867
diff changeset
  7476
!
364cff2aec4e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1867
diff changeset
  7477
1867
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7478
isFixedSize
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7479
    "return true if the receiver cannot grow easily 
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7480
     (i.e. a grow may be expensive, since it involves a become:)"
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7481
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7482
    ^ true
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7483
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7484
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7485
isForm
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7486
    "return true, if the receiver is some kind of form;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7487
     false is returned here - the method is only redefined in Form."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7488
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7489
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7490
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7491
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7492
isFraction
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7493
    "return true, if the receiver is some kind of fraction;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7494
     false is returned here - the method is only redefined in Fraction."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7495
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7496
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7497
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7498
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7499
isImage
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7500
    "return true, if the receiver is some kind of image;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7501
     false is returned here - the method is only redefined in Image."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7502
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7503
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7504
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7505
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7506
isImageOrForm
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7507
    "return true, if the receiver is some kind of image or form;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7508
     false is returned here - the method is only redefined in Image and Form."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7509
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7510
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7511
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7512
2673
f514189f6096 added #isImmediate for VW compatibility
Claus Gittinger <cg@exept.de>
parents: 2655
diff changeset
  7513
isImmediate
4666
912683a1af94 comments
Claus Gittinger <cg@exept.de>
parents: 4664
diff changeset
  7514
    "return true if I am an immediate object
912683a1af94 comments
Claus Gittinger <cg@exept.de>
parents: 4664
diff changeset
  7515
     i.e. I am represented in the pointer itself and
912683a1af94 comments
Claus Gittinger <cg@exept.de>
parents: 4664
diff changeset
  7516
     no real object header/storage is used me.
5472
82a213bd7b6e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5466
diff changeset
  7517
     (currently, only SmallIntegers, some characters and nil return true)"
2673
f514189f6096 added #isImmediate for VW compatibility
Claus Gittinger <cg@exept.de>
parents: 2655
diff changeset
  7518
f514189f6096 added #isImmediate for VW compatibility
Claus Gittinger <cg@exept.de>
parents: 2655
diff changeset
  7519
    ^ self class hasImmediateInstances
f514189f6096 added #isImmediate for VW compatibility
Claus Gittinger <cg@exept.de>
parents: 2655
diff changeset
  7520
f514189f6096 added #isImmediate for VW compatibility
Claus Gittinger <cg@exept.de>
parents: 2655
diff changeset
  7521
    "Created: 3.6.1997 / 12:00:18 / cg"
f514189f6096 added #isImmediate for VW compatibility
Claus Gittinger <cg@exept.de>
parents: 2655
diff changeset
  7522
!
f514189f6096 added #isImmediate for VW compatibility
Claus Gittinger <cg@exept.de>
parents: 2655
diff changeset
  7523
1867
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7524
isInteger
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7525
    "return true, if the receiver is some kind of integer number;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7526
     false is returned here - the method is only redefined in Integer."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7527
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7528
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7529
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7530
2502
8f3bf6043968 added #isJavaObject & #isJavaClass
Claus Gittinger <cg@exept.de>
parents: 2480
diff changeset
  7531
isJavaClass
3436
1a80952e6619 added #isJavaContext and some comments.
Claus Gittinger <cg@exept.de>
parents: 3423
diff changeset
  7532
    "return true, if this is a javaClass.
1a80952e6619 added #isJavaContext and some comments.
Claus Gittinger <cg@exept.de>
parents: 3423
diff changeset
  7533
     false is returned here - the method is only redefined in JavaClass."
1a80952e6619 added #isJavaContext and some comments.
Claus Gittinger <cg@exept.de>
parents: 3423
diff changeset
  7534
2502
8f3bf6043968 added #isJavaObject & #isJavaClass
Claus Gittinger <cg@exept.de>
parents: 2480
diff changeset
  7535
    ^ false
8f3bf6043968 added #isJavaObject & #isJavaClass
Claus Gittinger <cg@exept.de>
parents: 2480
diff changeset
  7536
3436
1a80952e6619 added #isJavaContext and some comments.
Claus Gittinger <cg@exept.de>
parents: 3423
diff changeset
  7537
    "Created: / 26.3.1997 / 13:34:54 / cg"
1a80952e6619 added #isJavaContext and some comments.
Claus Gittinger <cg@exept.de>
parents: 3423
diff changeset
  7538
    "Modified: / 8.5.1998 / 21:25:21 / cg"
1a80952e6619 added #isJavaContext and some comments.
Claus Gittinger <cg@exept.de>
parents: 3423
diff changeset
  7539
!
1a80952e6619 added #isJavaContext and some comments.
Claus Gittinger <cg@exept.de>
parents: 3423
diff changeset
  7540
5149
0da06a139105 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5130
diff changeset
  7541
isJavaClassRef
0da06a139105 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5130
diff changeset
  7542
    "return true, if this is a JavaClassRef.
0da06a139105 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5130
diff changeset
  7543
     false is returned here - the method is only redefined in JavaClassRef."
0da06a139105 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5130
diff changeset
  7544
0da06a139105 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5130
diff changeset
  7545
    ^ false
0da06a139105 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5130
diff changeset
  7546
0da06a139105 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5130
diff changeset
  7547
    "Modified: / 8.5.1998 / 21:25:46 / cg"
0da06a139105 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5130
diff changeset
  7548
    "Created: / 24.12.1999 / 01:46:28 / cg"
0da06a139105 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5130
diff changeset
  7549
!
0da06a139105 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5130
diff changeset
  7550
3436
1a80952e6619 added #isJavaContext and some comments.
Claus Gittinger <cg@exept.de>
parents: 3423
diff changeset
  7551
isJavaContext
1a80952e6619 added #isJavaContext and some comments.
Claus Gittinger <cg@exept.de>
parents: 3423
diff changeset
  7552
    "return true, if this is a javaContext.
1a80952e6619 added #isJavaContext and some comments.
Claus Gittinger <cg@exept.de>
parents: 3423
diff changeset
  7553
     false is returned here - the method is only redefined in JavaContext."
1a80952e6619 added #isJavaContext and some comments.
Claus Gittinger <cg@exept.de>
parents: 3423
diff changeset
  7554
1a80952e6619 added #isJavaContext and some comments.
Claus Gittinger <cg@exept.de>
parents: 3423
diff changeset
  7555
    ^ false
1a80952e6619 added #isJavaContext and some comments.
Claus Gittinger <cg@exept.de>
parents: 3423
diff changeset
  7556
1a80952e6619 added #isJavaContext and some comments.
Claus Gittinger <cg@exept.de>
parents: 3423
diff changeset
  7557
    "Created: / 8.5.1998 / 21:24:27 / cg"
1a80952e6619 added #isJavaContext and some comments.
Claus Gittinger <cg@exept.de>
parents: 3423
diff changeset
  7558
    "Modified: / 8.5.1998 / 21:25:35 / cg"
2502
8f3bf6043968 added #isJavaObject & #isJavaClass
Claus Gittinger <cg@exept.de>
parents: 2480
diff changeset
  7559
!
8f3bf6043968 added #isJavaObject & #isJavaClass
Claus Gittinger <cg@exept.de>
parents: 2480
diff changeset
  7560
4816
34d541d3fedd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4815
diff changeset
  7561
isJavaMethod
34d541d3fedd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4815
diff changeset
  7562
    "return true, if this is a JavaMethod.
34d541d3fedd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4815
diff changeset
  7563
     false is returned here - the method is only redefined in JavaMethod."
34d541d3fedd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4815
diff changeset
  7564
34d541d3fedd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4815
diff changeset
  7565
    ^ false
34d541d3fedd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4815
diff changeset
  7566
34d541d3fedd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4815
diff changeset
  7567
    "Modified: / 8.5.1998 / 21:25:46 / cg"
34d541d3fedd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4815
diff changeset
  7568
    "Created: / 25.9.1999 / 23:26:12 / cg"
34d541d3fedd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4815
diff changeset
  7569
!
34d541d3fedd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4815
diff changeset
  7570
5129
dc82dcd6825d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5085
diff changeset
  7571
isJavaMethodRef
dc82dcd6825d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5085
diff changeset
  7572
    "return true, if this is a JavaMethodRef.
dc82dcd6825d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5085
diff changeset
  7573
     false is returned here - the method is only redefined in JavaMethodRef."
dc82dcd6825d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5085
diff changeset
  7574
dc82dcd6825d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5085
diff changeset
  7575
    ^ false
dc82dcd6825d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5085
diff changeset
  7576
dc82dcd6825d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5085
diff changeset
  7577
    "Modified: / 8.5.1998 / 21:25:46 / cg"
dc82dcd6825d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5085
diff changeset
  7578
    "Created: / 23.12.1999 / 19:44:51 / cg"
dc82dcd6825d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5085
diff changeset
  7579
!
dc82dcd6825d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5085
diff changeset
  7580
2502
8f3bf6043968 added #isJavaObject & #isJavaClass
Claus Gittinger <cg@exept.de>
parents: 2480
diff changeset
  7581
isJavaObject
3436
1a80952e6619 added #isJavaContext and some comments.
Claus Gittinger <cg@exept.de>
parents: 3423
diff changeset
  7582
    "return true, if this is a javaObject.
1a80952e6619 added #isJavaContext and some comments.
Claus Gittinger <cg@exept.de>
parents: 3423
diff changeset
  7583
     false is returned here - the method is only redefined in JavaObject."
1a80952e6619 added #isJavaContext and some comments.
Claus Gittinger <cg@exept.de>
parents: 3423
diff changeset
  7584
2502
8f3bf6043968 added #isJavaObject & #isJavaClass
Claus Gittinger <cg@exept.de>
parents: 2480
diff changeset
  7585
    ^ false
8f3bf6043968 added #isJavaObject & #isJavaClass
Claus Gittinger <cg@exept.de>
parents: 2480
diff changeset
  7586
3436
1a80952e6619 added #isJavaContext and some comments.
Claus Gittinger <cg@exept.de>
parents: 3423
diff changeset
  7587
    "Created: / 26.3.1997 / 13:34:48 / cg"
1a80952e6619 added #isJavaContext and some comments.
Claus Gittinger <cg@exept.de>
parents: 3423
diff changeset
  7588
    "Modified: / 8.5.1998 / 21:25:46 / cg"
2502
8f3bf6043968 added #isJavaObject & #isJavaClass
Claus Gittinger <cg@exept.de>
parents: 2480
diff changeset
  7589
!
8f3bf6043968 added #isJavaObject & #isJavaClass
Claus Gittinger <cg@exept.de>
parents: 2480
diff changeset
  7590
5686
3d39e8679d2a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5627
diff changeset
  7591
isJavaScriptClass
3d39e8679d2a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5627
diff changeset
  7592
    "return true, if this is a javaScriptClass.
3d39e8679d2a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5627
diff changeset
  7593
     false is returned here - the method is only redefined in JavaScriptClass."
3d39e8679d2a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5627
diff changeset
  7594
3d39e8679d2a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5627
diff changeset
  7595
    ^ false
3d39e8679d2a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5627
diff changeset
  7596
!
3d39e8679d2a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5627
diff changeset
  7597
1867
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7598
isKindOf:aClass
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7599
    "return true, if the receiver is an instance of aClass or one of its
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7600
     subclasses, false otherwise.
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7601
     Advice: 
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  7602
        use of this to check objects for certain attributes/protocoll should
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  7603
        be avoided; it limits the reusability of your classes by limiting use
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  7604
        to instances of certain classes and fences you into a specific inheritance 
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  7605
        hierarchy.
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  7606
        Use check-methods to check an object for a certain attributes/protocol
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  7607
        (such as #isXXXX, #respondsTo: or #isNumber).
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  7608
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  7609
        Using #isKindOf: is considered BAD STYLE.
1867
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7610
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7611
     Advice2:
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  7612
        Be aware, that using an #isXXX method is usually much faster than 
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  7613
        using #isKindOf:; because isKindOf: has to walk up all the superclass 
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  7614
        hierarchy, comparing every class on the way. 
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  7615
        Due to caching in the VM, a call to #isXXX is normally reached via
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  7616
        a single function call.
1867
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7617
     "
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7618
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7619
%{  /* NOCONTEXT */
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7620
    register OBJ thisClass;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7621
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7622
    thisClass = __Class(self);
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7623
    while (thisClass != nil) {
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  7624
        if (thisClass == aClass) {
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  7625
            RETURN ( true );
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  7626
        }
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  7627
        thisClass = __ClassInstPtr(thisClass)->c_superclass;
1867
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7628
    }
5421
6dda4984b524 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5418
diff changeset
  7629
    RETURN ( false );
1867
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7630
%}
5421
6dda4984b524 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5418
diff changeset
  7631
1867
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7632
"/
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7633
"/  the above code is equivalent to:
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7634
"/
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7635
"/  thisClass := self class.
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7636
"/  [thisClass notNil] whileTrue:[
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7637
"/      thisClass == aClass ifTrue:[^ true].
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7638
"/      thisClass := thisClass superclass
5421
6dda4984b524 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5418
diff changeset
  7639
"/  ].
6dda4984b524 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5418
diff changeset
  7640
"/  ^ false
1867
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7641
"/
5421
6dda4984b524 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5418
diff changeset
  7642
1867
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7643
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7644
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7645
isLayout
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7646
    "return true, if the receiver is some kind of layout;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7647
     false is returned here - the method is only redefined in Layout."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7648
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7649
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7650
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7651
5252
6d3c2db1daa5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5195
diff changeset
  7652
isList
6d3c2db1daa5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5195
diff changeset
  7653
    "return true, if the receiver is some kind of list collection;
6d3c2db1daa5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5195
diff changeset
  7654
     false is returned here - the method is only redefined in List."
6d3c2db1daa5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5195
diff changeset
  7655
6d3c2db1daa5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5195
diff changeset
  7656
    ^ false
6d3c2db1daa5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5195
diff changeset
  7657
6d3c2db1daa5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5195
diff changeset
  7658
    "Created: / 11.2.2000 / 01:37:05 / cg"
6d3c2db1daa5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5195
diff changeset
  7659
!
6d3c2db1daa5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5195
diff changeset
  7660
1867
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7661
isLiteral
4666
912683a1af94 comments
Claus Gittinger <cg@exept.de>
parents: 4664
diff changeset
  7662
    "return true, if the receiver can be represented as a literal constant in ST syntax;
1867
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7663
     false is returned here - the method is redefined in some classes."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7664
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7665
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7666
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7667
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7668
isMemberOf:aClass
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7669
    "return true, if the receiver is an instance of aClass, false otherwise.
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7670
     Advice: 
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  7671
        use of this to check objects for certain attributes/protocoll should
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  7672
        be avoided; it limits the reusability of your classes by limiting use
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  7673
        to instances of a certain class.
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  7674
        Use check-methods to check an object for a certain attributes/protocol
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  7675
        (such as #isXXX, #respondsTo: or #isNumber);
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  7676
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  7677
        Using #isMemberOf: is considered BAD STYLE.
3044
a0bbac91639b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3023
diff changeset
  7678
     Notice:
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  7679
        This method is open coded (inlined) by the compiler(s)
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  7680
        - redefining it may not work as expected."
1867
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7681
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7682
    ^ (self class) == aClass
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7683
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7684
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7685
isMeta
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7686
    "return true, if the receiver is some kind of metaclass;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7687
     false is returned here - the method is only redefined in Metaclass."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7688
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7689
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7690
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7691
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7692
isMethod
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7693
    "return true, if the receiver is some kind of method;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7694
     false returned here - the method is only redefined in Method."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7695
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7696
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7697
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7698
4992
357cfb1de045 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4991
diff changeset
  7699
isMorph
357cfb1de045 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4991
diff changeset
  7700
    "return true, if the receiver is some kind of morph;
357cfb1de045 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4991
diff changeset
  7701
     false is returned here - the method is only redefined in Morph."
357cfb1de045 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4991
diff changeset
  7702
357cfb1de045 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4991
diff changeset
  7703
    ^ false
357cfb1de045 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4991
diff changeset
  7704
!
357cfb1de045 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4991
diff changeset
  7705
5327
5e5602d156fa #isNamespace renamed to #isNameSpace
Claus Gittinger <cg@exept.de>
parents: 5307
diff changeset
  7706
isNameSpace
3436
1a80952e6619 added #isJavaContext and some comments.
Claus Gittinger <cg@exept.de>
parents: 3423
diff changeset
  7707
    "return true, if this is a nameSpace.
1a80952e6619 added #isJavaContext and some comments.
Claus Gittinger <cg@exept.de>
parents: 3423
diff changeset
  7708
     false is returned here - the method is only redefined in Namespace."
1a80952e6619 added #isJavaContext and some comments.
Claus Gittinger <cg@exept.de>
parents: 3423
diff changeset
  7709
1867
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7710
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7711
3436
1a80952e6619 added #isJavaContext and some comments.
Claus Gittinger <cg@exept.de>
parents: 3423
diff changeset
  7712
    "Created: / 11.10.1996 / 18:08:56 / cg"
1a80952e6619 added #isJavaContext and some comments.
Claus Gittinger <cg@exept.de>
parents: 3423
diff changeset
  7713
    "Modified: / 8.5.1998 / 21:26:05 / cg"
1867
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7714
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7715
5327
5e5602d156fa #isNamespace renamed to #isNameSpace
Claus Gittinger <cg@exept.de>
parents: 5307
diff changeset
  7716
isNamespace
5e5602d156fa #isNamespace renamed to #isNameSpace
Claus Gittinger <cg@exept.de>
parents: 5307
diff changeset
  7717
    "return true, if this is a nameSpace.
5e5602d156fa #isNamespace renamed to #isNameSpace
Claus Gittinger <cg@exept.de>
parents: 5307
diff changeset
  7718
     false is returned here - the method is only redefined in Namespace."
5e5602d156fa #isNamespace renamed to #isNameSpace
Claus Gittinger <cg@exept.de>
parents: 5307
diff changeset
  7719
5e5602d156fa #isNamespace renamed to #isNameSpace
Claus Gittinger <cg@exept.de>
parents: 5307
diff changeset
  7720
    self obsoleteMethodWarning:'use #isNameSpace'.
5e5602d156fa #isNamespace renamed to #isNameSpace
Claus Gittinger <cg@exept.de>
parents: 5307
diff changeset
  7721
    ^ false
5e5602d156fa #isNamespace renamed to #isNameSpace
Claus Gittinger <cg@exept.de>
parents: 5307
diff changeset
  7722
5e5602d156fa #isNamespace renamed to #isNameSpace
Claus Gittinger <cg@exept.de>
parents: 5307
diff changeset
  7723
!
5e5602d156fa #isNamespace renamed to #isNameSpace
Claus Gittinger <cg@exept.de>
parents: 5307
diff changeset
  7724
1867
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7725
isNumber
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7726
    "return true, if the receiver is some kind of number;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7727
     false is returned here - the method is only redefined in Number."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7728
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7729
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7730
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7731
5402
d3cd213d13ec test for class
ps
parents: 5367
diff changeset
  7732
isOrderedCollection
d3cd213d13ec test for class
ps
parents: 5367
diff changeset
  7733
    "return true, if the receiver is some kind of ordered collection (or list etc);
d3cd213d13ec test for class
ps
parents: 5367
diff changeset
  7734
     false is returned here - the method is only redefined in OrderedCollection."
d3cd213d13ec test for class
ps
parents: 5367
diff changeset
  7735
d3cd213d13ec test for class
ps
parents: 5367
diff changeset
  7736
    ^ false
d3cd213d13ec test for class
ps
parents: 5367
diff changeset
  7737
!
d3cd213d13ec test for class
ps
parents: 5367
diff changeset
  7738
1867
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7739
isPoint
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7740
    "return true, if the receiver is some kind of point;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7741
     false is returned here - the method is only redefined in Point."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7742
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7743
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7744
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7745
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7746
isReal
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7747
    "return true, if the receiver is some kind of real number;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7748
     false is returned here - the method is only redefined in LimitedPrecisionReal."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7749
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7750
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7751
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7752
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7753
isRectangle
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7754
    "return true, if the receiver is some kind of rectangle;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7755
     false is returned here - the method is only redefined in Rectangle."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7756
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7757
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7758
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7759
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7760
isRemoteObject
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7761
    "return true, if the receiver is some kind of remoteObject,
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7762
     false if its local - the method is only redefined in RemoteObject."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7763
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7764
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7765
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7766
    "Created: 28.10.1996 / 15:18:45 / cg"
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7767
    "Modified: 28.10.1996 / 15:20:57 / cg"
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7768
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7769
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7770
isSequenceable
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7771
    "return true, if the receiver is some kind of sequenceable collection;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7772
     false is returned here - the method is only redefined in SequenceableCollection."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7773
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7774
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7775
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7776
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7777
isSequenceableCollection
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7778
    "OBSOLETE: use isSequenceable for ST-80 compatibility.
4007
561d175af944 added #isStringCollection
Claus Gittinger <cg@exept.de>
parents: 3999
diff changeset
  7779
     This method is a historic leftover and will be removed soon ...
561d175af944 added #isStringCollection
Claus Gittinger <cg@exept.de>
parents: 3999
diff changeset
  7780
     (although its name is much better than #isSequenceable - sigh)"
1867
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7781
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7782
    self obsoleteMethodWarning:'use #isSequenceable'.
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7783
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7784
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7785
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7786
isSignal
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7787
    "return true, if the receiver is some kind of signal;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7788
     false returned here - the method is only redefined in Signal."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7789
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7790
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7791
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7792
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7793
isStream
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7794
    "return true, if the receiver is some kind of stream;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7795
     false is returned here - the method is only redefined in Stream."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7796
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7797
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7798
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7799
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7800
isString
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7801
    "return true, if the receiver is some kind of string;
4683
58f7ae8b2e44 comment
Claus Gittinger <cg@exept.de>
parents: 4682
diff changeset
  7802
     false is returned here - the method is only redefined in CharacterArray."
1867
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7803
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7804
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7805
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7806
4007
561d175af944 added #isStringCollection
Claus Gittinger <cg@exept.de>
parents: 3999
diff changeset
  7807
isStringCollection
561d175af944 added #isStringCollection
Claus Gittinger <cg@exept.de>
parents: 3999
diff changeset
  7808
    "return true, if the receiver is some kind of stringCollection;
561d175af944 added #isStringCollection
Claus Gittinger <cg@exept.de>
parents: 3999
diff changeset
  7809
     false is returned here - the method is only redefined in StringCollection."
561d175af944 added #isStringCollection
Claus Gittinger <cg@exept.de>
parents: 3999
diff changeset
  7810
561d175af944 added #isStringCollection
Claus Gittinger <cg@exept.de>
parents: 3999
diff changeset
  7811
    ^ false
561d175af944 added #isStringCollection
Claus Gittinger <cg@exept.de>
parents: 3999
diff changeset
  7812
!
561d175af944 added #isStringCollection
Claus Gittinger <cg@exept.de>
parents: 3999
diff changeset
  7813
1867
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7814
isSymbol
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7815
    "return true, if the receiver is some kind of symbol;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7816
     false is returned here - the method is only redefined in Symbol."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7817
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7818
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7819
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7820
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7821
isText
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7822
    "return true, if the receiver is some kind of text object;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7823
     false is returned here - the method is only redefined in Text."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7824
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7825
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7826
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7827
    "Created: 12.5.1996 / 10:56:50 / cg"
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7828
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7829
4009
15be251e3a47 added #isValueModel
Claus Gittinger <cg@exept.de>
parents: 4007
diff changeset
  7830
isValueModel
15be251e3a47 added #isValueModel
Claus Gittinger <cg@exept.de>
parents: 4007
diff changeset
  7831
    "return true, if the receiver is some kind of valueModel;
15be251e3a47 added #isValueModel
Claus Gittinger <cg@exept.de>
parents: 4007
diff changeset
  7832
     false is returned here - the method is only redefined in ValueModel."
15be251e3a47 added #isValueModel
Claus Gittinger <cg@exept.de>
parents: 4007
diff changeset
  7833
15be251e3a47 added #isValueModel
Claus Gittinger <cg@exept.de>
parents: 4007
diff changeset
  7834
    ^ false
15be251e3a47 added #isValueModel
Claus Gittinger <cg@exept.de>
parents: 4007
diff changeset
  7835
15be251e3a47 added #isValueModel
Claus Gittinger <cg@exept.de>
parents: 4007
diff changeset
  7836
!
15be251e3a47 added #isValueModel
Claus Gittinger <cg@exept.de>
parents: 4007
diff changeset
  7837
1867
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7838
isVariable
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7839
    "return true if the receiver has indexed instance variables,
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7840
     false otherwise."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7841
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7842
    ^ self class isVariable
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7843
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7844
2704
3f56a3a9908a more ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2689
diff changeset
  7845
isVariableBinding
3436
1a80952e6619 added #isJavaContext and some comments.
Claus Gittinger <cg@exept.de>
parents: 3423
diff changeset
  7846
    "return true, if this is a binding for a variable.
1a80952e6619 added #isJavaContext and some comments.
Claus Gittinger <cg@exept.de>
parents: 3423
diff changeset
  7847
     false is returned here - the method is only redefined in Binding."
1a80952e6619 added #isJavaContext and some comments.
Claus Gittinger <cg@exept.de>
parents: 3423
diff changeset
  7848
2704
3f56a3a9908a more ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2689
diff changeset
  7849
    ^ false
3f56a3a9908a more ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2689
diff changeset
  7850
3436
1a80952e6619 added #isJavaContext and some comments.
Claus Gittinger <cg@exept.de>
parents: 3423
diff changeset
  7851
    "Created: / 19.6.1997 / 17:38:44 / cg"
1a80952e6619 added #isJavaContext and some comments.
Claus Gittinger <cg@exept.de>
parents: 3423
diff changeset
  7852
    "Modified: / 8.5.1998 / 21:26:55 / cg"
2704
3f56a3a9908a more ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2689
diff changeset
  7853
!
3f56a3a9908a more ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2689
diff changeset
  7854
1867
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7855
isView
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7856
    "return true, if the receiver is some kind of view;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7857
     false is returned here - the method is only redefined in View."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7858
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7859
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7860
! !
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  7861
4664
925daae9ba0c Add traceInto:level:
Stefan Vogel <sv@exept.de>
parents: 4634
diff changeset
  7862
!Object methodsFor:'tracing'!
925daae9ba0c Add traceInto:level:
Stefan Vogel <sv@exept.de>
parents: 4634
diff changeset
  7863
4682
4158042a9c8c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  7864
traceInto:aRequestor level:level from:referrer
4664
925daae9ba0c Add traceInto:level:
Stefan Vogel <sv@exept.de>
parents: 4634
diff changeset
  7865
    "double dispatch into tracer, passing my type implicitely in the selector"
925daae9ba0c Add traceInto:level:
Stefan Vogel <sv@exept.de>
parents: 4634
diff changeset
  7866
4682
4158042a9c8c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  7867
    ^ aRequestor traceObject:self level:level from:referrer
4664
925daae9ba0c Add traceInto:level:
Stefan Vogel <sv@exept.de>
parents: 4634
diff changeset
  7868
925daae9ba0c Add traceInto:level:
Stefan Vogel <sv@exept.de>
parents: 4634
diff changeset
  7869
    "Created: / 2.9.1999 / 09:05:17 / stefan"
925daae9ba0c Add traceInto:level:
Stefan Vogel <sv@exept.de>
parents: 4634
diff changeset
  7870
! !
925daae9ba0c Add traceInto:level:
Stefan Vogel <sv@exept.de>
parents: 4634
diff changeset
  7871
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  7872
!Object methodsFor:'user interaction & notifications'!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  7873
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  7874
activityNotification:aString
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  7875
    "this can be sent from deeply nested methods, which are going to perform
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  7876
     some long-time activity.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  7877
     If there is a handler for the ActivityNotificationSignal signal, that one is raised,
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  7878
     passing the argument. The handler should show this message whereever it likes,
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  7879
     and proceed. If there is no handler, this is simply ignored.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  7880
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  7881
     This is very useful to pass busy messages up to some higher level (typically a view)
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  7882
     which likes to display that message in its label or a busy-box.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  7883
     It could also be put into some logfile or printed on the standard output/error."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  7884
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  7885
    ActivityNotificationSignal isHandled ifTrue:[
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  7886
        ^ ActivityNotificationSignal raiseRequestWith:self errorString:aString
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  7887
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  7888
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  7889
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  7890
     nil activityNotification:'hello there'
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  7891
     self activityNotification:'hello there'
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  7892
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  7893
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  7894
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  7895
     ActivityNotificationSignal handle:[:ex |
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  7896
        ex errorString printNL.
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  7897
        ex proceed.
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  7898
     ] do:[
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  7899
        'hello' printNL.
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  7900
        self activityNotification:'doing some long time computation'.
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  7901
        'world' printNL.
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  7902
     ]
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  7903
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  7904
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  7905
    "Modified: 16.12.1995 / 18:23:42 / cg"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  7906
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  7907
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  7908
confirm:aString
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  7909
    "launch a confirmer, which allows user to enter yes or no.
5084
0daca20f05d6 added confirmWithCancel
Claus Gittinger <cg@exept.de>
parents: 5083
diff changeset
  7910
     return true for yes, false for no.
0daca20f05d6 added confirmWithCancel
Claus Gittinger <cg@exept.de>
parents: 5083
diff changeset
  7911
     If no GUI is present (headless applications), true is returned."
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  7912
925
020a15fa450f use less memory for single-dependencies;
Claus Gittinger <cg@exept.de>
parents: 899
diff changeset
  7913
    "
020a15fa450f use less memory for single-dependencies;
Claus Gittinger <cg@exept.de>
parents: 899
diff changeset
  7914
     on systems without GUI, or during startup, output a message
020a15fa450f use less memory for single-dependencies;
Claus Gittinger <cg@exept.de>
parents: 899
diff changeset
  7915
     and return true (as if yes was answered)
020a15fa450f use less memory for single-dependencies;
Claus Gittinger <cg@exept.de>
parents: 899
diff changeset
  7916
     Q: should we ask user by reading Stdin ?
020a15fa450f use less memory for single-dependencies;
Claus Gittinger <cg@exept.de>
parents: 899
diff changeset
  7917
    "
020a15fa450f use less memory for single-dependencies;
Claus Gittinger <cg@exept.de>
parents: 899
diff changeset
  7918
    Smalltalk isInitialized ifFalse:[
5082
211f9c06656c oops - confirm/notify where wrong in the non-gui case
Claus Gittinger <cg@exept.de>
parents: 5081
diff changeset
  7919
        '*** confirmation requested during initialization:' errorPrintCR. 
211f9c06656c oops - confirm/notify where wrong in the non-gui case
Claus Gittinger <cg@exept.de>
parents: 5081
diff changeset
  7920
        aString errorPrintCR.
211f9c06656c oops - confirm/notify where wrong in the non-gui case
Claus Gittinger <cg@exept.de>
parents: 5081
diff changeset
  7921
        '*** I''ll continue, assuming <yes> ...' errorPrintCR.
5081
7e8bd5012897 care for warning, notify and information when no Screen is present.
Claus Gittinger <cg@exept.de>
parents: 5062
diff changeset
  7922
        ^ true
925
020a15fa450f use less memory for single-dependencies;
Claus Gittinger <cg@exept.de>
parents: 899
diff changeset
  7923
    ].
020a15fa450f use less memory for single-dependencies;
Claus Gittinger <cg@exept.de>
parents: 899
diff changeset
  7924
5081
7e8bd5012897 care for warning, notify and information when no Screen is present.
Claus Gittinger <cg@exept.de>
parents: 5062
diff changeset
  7925
    (Dialog isNil 
7e8bd5012897 care for warning, notify and information when no Screen is present.
Claus Gittinger <cg@exept.de>
parents: 5062
diff changeset
  7926
    or:[Screen isNil
5195
de5ab488050b Do not try to use an unconnected display
Stefan Vogel <sv@exept.de>
parents: 5194
diff changeset
  7927
    or:[Screen current isNil
de5ab488050b Do not try to use an unconnected display
Stefan Vogel <sv@exept.de>
parents: 5194
diff changeset
  7928
    or:[Screen current isOpen not]]]) ifTrue:[       
5082
211f9c06656c oops - confirm/notify where wrong in the non-gui case
Claus Gittinger <cg@exept.de>
parents: 5081
diff changeset
  7929
        'confirm: ' infoPrint.
211f9c06656c oops - confirm/notify where wrong in the non-gui case
Claus Gittinger <cg@exept.de>
parents: 5081
diff changeset
  7930
        aString infoPrintCR.
211f9c06656c oops - confirm/notify where wrong in the non-gui case
Claus Gittinger <cg@exept.de>
parents: 5081
diff changeset
  7931
        'continue, assuming <yes>' infoPrintCR.
5081
7e8bd5012897 care for warning, notify and information when no Screen is present.
Claus Gittinger <cg@exept.de>
parents: 5062
diff changeset
  7932
        ^ true
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  7933
    ].
5082
211f9c06656c oops - confirm/notify where wrong in the non-gui case
Claus Gittinger <cg@exept.de>
parents: 5081
diff changeset
  7934
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  7935
    Dialog autoload.        "in case its autoloaded"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  7936
    ^ Dialog confirm:aString
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  7937
        
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  7938
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  7939
     nil confirm:'hello'
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  7940
     self confirm:'hello'
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  7941
    "
1417
59e7d3c1df6d showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1397
diff changeset
  7942
1425
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  7943
    "Modified: 20.5.1996 / 10:28:40 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  7944
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  7945
5367
76120309ae8b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5356
diff changeset
  7946
confirm:aString orCancel:cancelBlock
76120309ae8b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5356
diff changeset
  7947
    "launch a confirmer, which allows user to enter yes, no or cancel.
76120309ae8b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5356
diff changeset
  7948
     return true for yes, false for no, or the value from cancelBlock for cancel.
76120309ae8b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5356
diff changeset
  7949
     If no GUI is present (headless applications), cancelBlock is returned."
76120309ae8b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5356
diff changeset
  7950
76120309ae8b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5356
diff changeset
  7951
    |answer|
76120309ae8b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5356
diff changeset
  7952
76120309ae8b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5356
diff changeset
  7953
    answer := self confirmWithCancel:aString.
76120309ae8b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5356
diff changeset
  7954
    answer isNil ifTrue:[
76120309ae8b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5356
diff changeset
  7955
        ^ cancelBlock value
76120309ae8b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5356
diff changeset
  7956
    ].
76120309ae8b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5356
diff changeset
  7957
    ^ answer
76120309ae8b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5356
diff changeset
  7958
        
76120309ae8b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5356
diff changeset
  7959
    "
76120309ae8b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5356
diff changeset
  7960
     self confirm:'hello' orCancel:[self halt]
76120309ae8b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5356
diff changeset
  7961
    "
76120309ae8b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5356
diff changeset
  7962
76120309ae8b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5356
diff changeset
  7963
    "Modified: 20.5.1996 / 10:28:40 / cg"
76120309ae8b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5356
diff changeset
  7964
!
76120309ae8b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5356
diff changeset
  7965
5084
0daca20f05d6 added confirmWithCancel
Claus Gittinger <cg@exept.de>
parents: 5083
diff changeset
  7966
confirmWithCancel:aString
0daca20f05d6 added confirmWithCancel
Claus Gittinger <cg@exept.de>
parents: 5083
diff changeset
  7967
    "launch a confirmer, which allows user to enter yes, no or cancel.
0daca20f05d6 added confirmWithCancel
Claus Gittinger <cg@exept.de>
parents: 5083
diff changeset
  7968
     return true for yes, false for no, nil for cancel.
0daca20f05d6 added confirmWithCancel
Claus Gittinger <cg@exept.de>
parents: 5083
diff changeset
  7969
     If no GUI is present (headless applications), nil is returned."
0daca20f05d6 added confirmWithCancel
Claus Gittinger <cg@exept.de>
parents: 5083
diff changeset
  7970
0daca20f05d6 added confirmWithCancel
Claus Gittinger <cg@exept.de>
parents: 5083
diff changeset
  7971
    "
0daca20f05d6 added confirmWithCancel
Claus Gittinger <cg@exept.de>
parents: 5083
diff changeset
  7972
     on systems without GUI, or during startup, output a message
0daca20f05d6 added confirmWithCancel
Claus Gittinger <cg@exept.de>
parents: 5083
diff changeset
  7973
     and return true (as if yes was answered)
0daca20f05d6 added confirmWithCancel
Claus Gittinger <cg@exept.de>
parents: 5083
diff changeset
  7974
     Q: should we ask user by reading Stdin ?
0daca20f05d6 added confirmWithCancel
Claus Gittinger <cg@exept.de>
parents: 5083
diff changeset
  7975
    "
0daca20f05d6 added confirmWithCancel
Claus Gittinger <cg@exept.de>
parents: 5083
diff changeset
  7976
    Smalltalk isInitialized ifFalse:[
0daca20f05d6 added confirmWithCancel
Claus Gittinger <cg@exept.de>
parents: 5083
diff changeset
  7977
        '*** confirmation requested during initialization:' errorPrintCR. 
0daca20f05d6 added confirmWithCancel
Claus Gittinger <cg@exept.de>
parents: 5083
diff changeset
  7978
        aString errorPrintCR.
0daca20f05d6 added confirmWithCancel
Claus Gittinger <cg@exept.de>
parents: 5083
diff changeset
  7979
        '*** I''ll continue, assuming <cancel> ...' errorPrintCR.
0daca20f05d6 added confirmWithCancel
Claus Gittinger <cg@exept.de>
parents: 5083
diff changeset
  7980
        ^ nil
0daca20f05d6 added confirmWithCancel
Claus Gittinger <cg@exept.de>
parents: 5083
diff changeset
  7981
    ].
0daca20f05d6 added confirmWithCancel
Claus Gittinger <cg@exept.de>
parents: 5083
diff changeset
  7982
0daca20f05d6 added confirmWithCancel
Claus Gittinger <cg@exept.de>
parents: 5083
diff changeset
  7983
    (Dialog isNil 
0daca20f05d6 added confirmWithCancel
Claus Gittinger <cg@exept.de>
parents: 5083
diff changeset
  7984
    or:[Screen isNil
5195
de5ab488050b Do not try to use an unconnected display
Stefan Vogel <sv@exept.de>
parents: 5194
diff changeset
  7985
    or:[Screen current isNil
de5ab488050b Do not try to use an unconnected display
Stefan Vogel <sv@exept.de>
parents: 5194
diff changeset
  7986
    or:[Screen current isOpen not]]]) ifTrue:[       
5084
0daca20f05d6 added confirmWithCancel
Claus Gittinger <cg@exept.de>
parents: 5083
diff changeset
  7987
        'confirm: ' infoPrint.
0daca20f05d6 added confirmWithCancel
Claus Gittinger <cg@exept.de>
parents: 5083
diff changeset
  7988
        aString infoPrintCR.
0daca20f05d6 added confirmWithCancel
Claus Gittinger <cg@exept.de>
parents: 5083
diff changeset
  7989
        'continue, assuming <cancel>' infoPrintCR.
0daca20f05d6 added confirmWithCancel
Claus Gittinger <cg@exept.de>
parents: 5083
diff changeset
  7990
        ^ nil
0daca20f05d6 added confirmWithCancel
Claus Gittinger <cg@exept.de>
parents: 5083
diff changeset
  7991
    ].
0daca20f05d6 added confirmWithCancel
Claus Gittinger <cg@exept.de>
parents: 5083
diff changeset
  7992
0daca20f05d6 added confirmWithCancel
Claus Gittinger <cg@exept.de>
parents: 5083
diff changeset
  7993
    Dialog autoload.        "in case its autoloaded"
0daca20f05d6 added confirmWithCancel
Claus Gittinger <cg@exept.de>
parents: 5083
diff changeset
  7994
    ^ Dialog confirmWithCancel:aString
0daca20f05d6 added confirmWithCancel
Claus Gittinger <cg@exept.de>
parents: 5083
diff changeset
  7995
        
0daca20f05d6 added confirmWithCancel
Claus Gittinger <cg@exept.de>
parents: 5083
diff changeset
  7996
    "
0daca20f05d6 added confirmWithCancel
Claus Gittinger <cg@exept.de>
parents: 5083
diff changeset
  7997
     nil confirmWithCancel:'hello' 
0daca20f05d6 added confirmWithCancel
Claus Gittinger <cg@exept.de>
parents: 5083
diff changeset
  7998
     self confirmWithCancel:'hello'
0daca20f05d6 added confirmWithCancel
Claus Gittinger <cg@exept.de>
parents: 5083
diff changeset
  7999
    "
0daca20f05d6 added confirmWithCancel
Claus Gittinger <cg@exept.de>
parents: 5083
diff changeset
  8000
0daca20f05d6 added confirmWithCancel
Claus Gittinger <cg@exept.de>
parents: 5083
diff changeset
  8001
    "Modified: 20.5.1996 / 10:28:40 / cg"
0daca20f05d6 added confirmWithCancel
Claus Gittinger <cg@exept.de>
parents: 5083
diff changeset
  8002
!
0daca20f05d6 added confirmWithCancel
Claus Gittinger <cg@exept.de>
parents: 5083
diff changeset
  8003
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  8004
errorNotify:aString
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  8005
    "launch a Notifier, showing top stack, telling user something
2150
3daace4e5fbc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2148
diff changeset
  8006
     and give user a chance to enter debugger."
3daace4e5fbc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2148
diff changeset
  8007
3daace4e5fbc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2148
diff changeset
  8008
    ^ self
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  8009
        errorNotify:aString 
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  8010
        from:thisContext sender
2150
3daace4e5fbc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2148
diff changeset
  8011
3daace4e5fbc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2148
diff changeset
  8012
    "
3daace4e5fbc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2148
diff changeset
  8013
     nil errorNotify:'hello there'
3daace4e5fbc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2148
diff changeset
  8014
     self errorNotify:'hello there'
3daace4e5fbc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2148
diff changeset
  8015
    "
3daace4e5fbc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2148
diff changeset
  8016
3daace4e5fbc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2148
diff changeset
  8017
    "Modified: 11.1.1997 / 18:39:20 / cg"
3daace4e5fbc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2148
diff changeset
  8018
!
3daace4e5fbc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2148
diff changeset
  8019
3daace4e5fbc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2148
diff changeset
  8020
errorNotify:aString from:aContext
3daace4e5fbc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2148
diff changeset
  8021
    "launch a Notifier, showing top stack (above aContext), 
3daace4e5fbc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2148
diff changeset
  8022
     telling user something and give user a chance to enter debugger."
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  8023
3766
f352e71081ed better errorNotify (debug-option supressable)
Claus Gittinger <cg@exept.de>
parents: 3694
diff changeset
  8024
    ^ self errorNotify:aString from:aContext allowDebug:true
f352e71081ed better errorNotify (debug-option supressable)
Claus Gittinger <cg@exept.de>
parents: 3694
diff changeset
  8025
f352e71081ed better errorNotify (debug-option supressable)
Claus Gittinger <cg@exept.de>
parents: 3694
diff changeset
  8026
    "Modified: / 17.8.1998 / 10:09:27 / cg"
f352e71081ed better errorNotify (debug-option supressable)
Claus Gittinger <cg@exept.de>
parents: 3694
diff changeset
  8027
!
f352e71081ed better errorNotify (debug-option supressable)
Claus Gittinger <cg@exept.de>
parents: 3694
diff changeset
  8028
f352e71081ed better errorNotify (debug-option supressable)
Claus Gittinger <cg@exept.de>
parents: 3694
diff changeset
  8029
errorNotify:aString from:aContext allowDebug:allowDebug
f352e71081ed better errorNotify (debug-option supressable)
Claus Gittinger <cg@exept.de>
parents: 3694
diff changeset
  8030
    "launch a Notifier, showing top stack (above aContext), 
f352e71081ed better errorNotify (debug-option supressable)
Claus Gittinger <cg@exept.de>
parents: 3694
diff changeset
  8031
     telling user something and optionally give the user a chance to enter debugger."
f352e71081ed better errorNotify (debug-option supressable)
Claus Gittinger <cg@exept.de>
parents: 3694
diff changeset
  8032
2082
36171caceb24 better errorNotify:
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  8033
    |info con sender action|
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  8034
891
6807b8576453 handle warnboxes during init
ah
parents: 889
diff changeset
  8035
    Smalltalk isInitialized ifFalse:[
4535
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  8036
        'errorNotification: ' print. aString printCR.
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  8037
        ^ self
891
6807b8576453 handle warnboxes during init
ah
parents: 889
diff changeset
  8038
    ].
5055
6d02262273a5 care for nil Display in #errorNotify:
Claus Gittinger <cg@exept.de>
parents: 4992
diff changeset
  8039
    (Dialog isNil 
6d02262273a5 care for nil Display in #errorNotify:
Claus Gittinger <cg@exept.de>
parents: 4992
diff changeset
  8040
    or:[Screen isNil
5195
de5ab488050b Do not try to use an unconnected display
Stefan Vogel <sv@exept.de>
parents: 5194
diff changeset
  8041
    or:[Screen current isNil
de5ab488050b Do not try to use an unconnected display
Stefan Vogel <sv@exept.de>
parents: 5194
diff changeset
  8042
    or:[Screen current isOpen not]]]) ifTrue:[       
4535
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  8043
        "
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  8044
         on systems without GUI, simply show
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  8045
         the message on the Transcript and abort.
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  8046
        "
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  8047
        Transcript showCR:aString.
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  8048
        AbortSignal raise.
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  8049
        ^ self
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  8050
    ].
2203
5899dbf1b69c go directly into the debugger if an error occurs
Claus Gittinger <cg@exept.de>
parents: 2194
diff changeset
  8051
5899dbf1b69c go directly into the debugger if an error occurs
Claus Gittinger <cg@exept.de>
parents: 2194
diff changeset
  8052
    Processor activeProcessIsSystemProcess ifTrue:[
4535
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  8053
        action := #debug.
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  8054
        sender := aContext.
5622
99aa49ae43e1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5621
diff changeset
  8055
        Debugger isNil ifTrue:[
99aa49ae43e1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5621
diff changeset
  8056
            '****************** Cought Error while in SystemProcess ****************' errorPrintCR.
99aa49ae43e1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5621
diff changeset
  8057
            thisContext fullPrintAll.
99aa49ae43e1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5621
diff changeset
  8058
            action := #abort.
99aa49ae43e1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5621
diff changeset
  8059
        ].
2203
5899dbf1b69c go directly into the debugger if an error occurs
Claus Gittinger <cg@exept.de>
parents: 2194
diff changeset
  8060
    ] ifFalse:[
4535
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  8061
        Dialog autoload.        "in case its autoloaded"
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  8062
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  8063
        ErrorSignal handle:[:ex |
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  8064
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  8065
            "/ a recursive error - quickly enter debugger
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  8066
            "/ this happened, when I corrupted the Dialog class ...
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  8067
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  8068
            ('Object [error]: ' , ex errorString , ' caught in errorNotification') errorPrintCR.
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  8069
            action := #debug.
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  8070
            ex return.
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  8071
        ] do:[
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  8072
            sender := aContext.
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  8073
            sender isNil ifTrue:[
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  8074
                sender := thisContext sender.
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  8075
                "/
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  8076
                "/ for your convenience: skip the emergencyHandler block
2203
5899dbf1b69c go directly into the debugger if an error occurs
Claus Gittinger <cg@exept.de>
parents: 2194
diff changeset
  8077
"/                sender isBlockContext ifTrue:[
5899dbf1b69c go directly into the debugger if an error occurs
Claus Gittinger <cg@exept.de>
parents: 2194
diff changeset
  8078
"/                    sender := sender sender
5899dbf1b69c go directly into the debugger if an error occurs
Claus Gittinger <cg@exept.de>
parents: 2194
diff changeset
  8079
"/                ].
4535
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  8080
            ].
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  8081
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  8082
            "/ skip intermediate (signal & exception) contexts
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  8083
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  8084
            DebugView notNil ifTrue:[
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  8085
                sender := DebugView interestingContextFrom:sender
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  8086
            ].
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  8087
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  8088
            "/ show the first 5 contexts
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  8089
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  8090
            con := sender.
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  8091
            info := aString , Character cr asString , Character cr asString.
5194
262d8638d2ef *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5180
diff changeset
  8092
            1 to:15 do:[:n |
4535
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  8093
                con notNil ifTrue:[
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  8094
                    info := info , con printString , Character cr asString.
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  8095
                    con := con sender
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  8096
                ]
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  8097
            ].
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  8098
5062
246b3b42534e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5055
diff changeset
  8099
            (allowDebug and:[Debugger notNil]) ifTrue:[
4535
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  8100
                action := Dialog 
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  8101
                        choose:info 
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  8102
                        label:('Exception [' , Processor activeProcess nameOrId , ']')
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  8103
                        labels:#('proceed' 'abort' 'debug')
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  8104
                        values:#(#proceed #abort #debug)
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  8105
                        default:#debug.
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  8106
            ] ifFalse:[
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  8107
                action := Dialog 
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  8108
                        choose:info 
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  8109
                        label:('Exception [' , Processor activeProcess nameOrId , ']')
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  8110
                        labels:#('proceed' 'abort')
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  8111
                        values:#(#proceed #abort)
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  8112
                        default:#abort.
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  8113
            ]
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  8114
        ].
2082
36171caceb24 better errorNotify:
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  8115
    ].
36171caceb24 better errorNotify:
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  8116
36171caceb24 better errorNotify:
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  8117
    action == #debug ifTrue:[
5622
99aa49ae43e1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5621
diff changeset
  8118
        Debugger enter:sender withMessage:aString mayProceed:true
2082
36171caceb24 better errorNotify:
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  8119
    ] ifFalse:[
4535
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  8120
        action == #abort ifTrue:[
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  8121
            AbortSignal raise
aaed5f554d8b code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents: 4529
diff changeset
  8122
        ]
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  8123
    ]
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  8124
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  8125
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  8126
     nil errorNotify:'hello there'
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  8127
     self errorNotify:'hello there'
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  8128
    "
1417
59e7d3c1df6d showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1397
diff changeset
  8129
3766
f352e71081ed better errorNotify (debug-option supressable)
Claus Gittinger <cg@exept.de>
parents: 3694
diff changeset
  8130
    "Modified: / 8.2.1997 / 12:47:41 / cg"
f352e71081ed better errorNotify (debug-option supressable)
Claus Gittinger <cg@exept.de>
parents: 3694
diff changeset
  8131
    "Created: / 17.8.1998 / 10:09:26 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  8132
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  8133
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  8134
information:aString
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  8135
    "launch an InfoBox, telling user something. 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  8136
     These info-boxes can be suppressed by handling the 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  8137
     UserNotification- or InformationSignal and proceeding in the handler."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  8138
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  8139
    InformationSignal isHandled ifTrue:[
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  8140
        ^ InformationSignal raiseRequestWith:self errorString:aString
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  8141
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  8142
    self notify:aString
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  8143
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  8144
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  8145
     nil information:'hello there'
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  8146
     self information:'hello there'
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  8147
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  8148
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  8149
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  8150
     InformationSignal handle:[:ex |
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  8151
        'no box popped' printNL.
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  8152
        ex proceed.
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  8153
     ] do:[
5356
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  8154
        'hello' printNL.
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  8155
        self information:'some info'.
5c8883c4f065 *** empty log message ***
ps
parents: 5354
diff changeset
  8156
        'world' printNL.
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  8157
     ]
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  8158
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  8159
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  8160
    "Modified: 24.11.1995 / 22:29:49 / cg"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  8161
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  8162
5084
0daca20f05d6 added confirmWithCancel
Claus Gittinger <cg@exept.de>
parents: 5083
diff changeset
  8163
notify:aString
0daca20f05d6 added confirmWithCancel
Claus Gittinger <cg@exept.de>
parents: 5083
diff changeset
  8164
    "launch a Notifier, telling user something.
0daca20f05d6 added confirmWithCancel
Claus Gittinger <cg@exept.de>
parents: 5083
diff changeset
  8165
     Use #information: for ignorable messages."
0daca20f05d6 added confirmWithCancel
Claus Gittinger <cg@exept.de>
parents: 5083
diff changeset
  8166
0daca20f05d6 added confirmWithCancel
Claus Gittinger <cg@exept.de>
parents: 5083
diff changeset
  8167
    Smalltalk isInitialized ifFalse:[
0daca20f05d6 added confirmWithCancel
Claus Gittinger <cg@exept.de>
parents: 5083
diff changeset
  8168
        'information: ' print. aString printCR.
0daca20f05d6 added confirmWithCancel
Claus Gittinger <cg@exept.de>
parents: 5083
diff changeset
  8169
        ^ self
0daca20f05d6 added confirmWithCancel
Claus Gittinger <cg@exept.de>
parents: 5083
diff changeset
  8170
    ].
0daca20f05d6 added confirmWithCancel
Claus Gittinger <cg@exept.de>
parents: 5083
diff changeset
  8171
0daca20f05d6 added confirmWithCancel
Claus Gittinger <cg@exept.de>
parents: 5083
diff changeset
  8172
    (Smalltalk isInitialized not
0daca20f05d6 added confirmWithCancel
Claus Gittinger <cg@exept.de>
parents: 5083
diff changeset
  8173
    or:[Dialog isNil
0daca20f05d6 added confirmWithCancel
Claus Gittinger <cg@exept.de>
parents: 5083
diff changeset
  8174
    or:[Screen isNil
5195
de5ab488050b Do not try to use an unconnected display
Stefan Vogel <sv@exept.de>
parents: 5194
diff changeset
  8175
    or:[Screen current isNil
de5ab488050b Do not try to use an unconnected display
Stefan Vogel <sv@exept.de>
parents: 5194
diff changeset
  8176
    or:[Screen current isOpen not]]]]) ifTrue:[
5084
0daca20f05d6 added confirmWithCancel
Claus Gittinger <cg@exept.de>
parents: 5083
diff changeset
  8177
        "
0daca20f05d6 added confirmWithCancel
Claus Gittinger <cg@exept.de>
parents: 5083
diff changeset
  8178
         on systems without GUI, simply show
0daca20f05d6 added confirmWithCancel
Claus Gittinger <cg@exept.de>
parents: 5083
diff changeset
  8179
         the message on the Transcript and abort.
0daca20f05d6 added confirmWithCancel
Claus Gittinger <cg@exept.de>
parents: 5083
diff changeset
  8180
        "
0daca20f05d6 added confirmWithCancel
Claus Gittinger <cg@exept.de>
parents: 5083
diff changeset
  8181
        Transcript show:'notification: '; showCR:aString.
0daca20f05d6 added confirmWithCancel
Claus Gittinger <cg@exept.de>
parents: 5083
diff changeset
  8182
        ^ self
0daca20f05d6 added confirmWithCancel
Claus Gittinger <cg@exept.de>
parents: 5083
diff changeset
  8183
    ].
0daca20f05d6 added confirmWithCancel
Claus Gittinger <cg@exept.de>
parents: 5083
diff changeset
  8184
0daca20f05d6 added confirmWithCancel
Claus Gittinger <cg@exept.de>
parents: 5083
diff changeset
  8185
    Dialog autoload.        "in case its autoloaded"
0daca20f05d6 added confirmWithCancel
Claus Gittinger <cg@exept.de>
parents: 5083
diff changeset
  8186
    Dialog information:aString
0daca20f05d6 added confirmWithCancel
Claus Gittinger <cg@exept.de>
parents: 5083
diff changeset
  8187
0daca20f05d6 added confirmWithCancel
Claus Gittinger <cg@exept.de>
parents: 5083
diff changeset
  8188
    "
0daca20f05d6 added confirmWithCancel
Claus Gittinger <cg@exept.de>
parents: 5083
diff changeset
  8189
     nil notify:'hello there'
0daca20f05d6 added confirmWithCancel
Claus Gittinger <cg@exept.de>
parents: 5083
diff changeset
  8190
     self notify:'hello there'
0daca20f05d6 added confirmWithCancel
Claus Gittinger <cg@exept.de>
parents: 5083
diff changeset
  8191
    "
0daca20f05d6 added confirmWithCancel
Claus Gittinger <cg@exept.de>
parents: 5083
diff changeset
  8192
0daca20f05d6 added confirmWithCancel
Claus Gittinger <cg@exept.de>
parents: 5083
diff changeset
  8193
    "Modified: 20.5.1996 / 10:28:48 / cg"
0daca20f05d6 added confirmWithCancel
Claus Gittinger <cg@exept.de>
parents: 5083
diff changeset
  8194
!
0daca20f05d6 added confirmWithCancel
Claus Gittinger <cg@exept.de>
parents: 5083
diff changeset
  8195
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  8196
warn:aString
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  8197
    "launch a WarningBox, telling user something.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  8198
     These warn-boxes can be suppressed by handling the 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  8199
     UserNotification- or WarningSignal and proceeding in the handler."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  8200
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  8201
    WarningSignal isHandled ifTrue:[
5081
7e8bd5012897 care for warning, notify and information when no Screen is present.
Claus Gittinger <cg@exept.de>
parents: 5062
diff changeset
  8202
        ^ WarningSignal raiseRequestWith:self errorString:aString
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  8203
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  8204
5082
211f9c06656c oops - confirm/notify where wrong in the non-gui case
Claus Gittinger <cg@exept.de>
parents: 5081
diff changeset
  8205
    (Smalltalk isInitialized not
5083
770f121b8569 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5082
diff changeset
  8206
    or:[Dialog isNil
5081
7e8bd5012897 care for warning, notify and information when no Screen is present.
Claus Gittinger <cg@exept.de>
parents: 5062
diff changeset
  8207
    or:[Screen isNil
5195
de5ab488050b Do not try to use an unconnected display
Stefan Vogel <sv@exept.de>
parents: 5194
diff changeset
  8208
    or:[Screen current isNil
de5ab488050b Do not try to use an unconnected display
Stefan Vogel <sv@exept.de>
parents: 5194
diff changeset
  8209
    or:[Screen current isOpen not]]]]) ifTrue:[       
5081
7e8bd5012897 care for warning, notify and information when no Screen is present.
Claus Gittinger <cg@exept.de>
parents: 5062
diff changeset
  8210
        "
7e8bd5012897 care for warning, notify and information when no Screen is present.
Claus Gittinger <cg@exept.de>
parents: 5062
diff changeset
  8211
         on systems without GUI, simply show
7e8bd5012897 care for warning, notify and information when no Screen is present.
Claus Gittinger <cg@exept.de>
parents: 5062
diff changeset
  8212
         the message on the Transcript and abort.
7e8bd5012897 care for warning, notify and information when no Screen is present.
Claus Gittinger <cg@exept.de>
parents: 5062
diff changeset
  8213
        "
7e8bd5012897 care for warning, notify and information when no Screen is present.
Claus Gittinger <cg@exept.de>
parents: 5062
diff changeset
  8214
        Transcript show:'warning: '; showCR:aString.
7e8bd5012897 care for warning, notify and information when no Screen is present.
Claus Gittinger <cg@exept.de>
parents: 5062
diff changeset
  8215
        ^ self
891
6807b8576453 handle warnboxes during init
ah
parents: 889
diff changeset
  8216
    ].
6807b8576453 handle warnboxes during init
ah
parents: 889
diff changeset
  8217
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  8218
    Dialog autoload.        "in case its autoloaded"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  8219
    Dialog warn:aString
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  8220
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  8221
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  8222
     nil warn:'hello there'
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  8223
     self warn:'hello there'
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  8224
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  8225
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  8226
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  8227
     WarningSignal handle:[:ex |
5081
7e8bd5012897 care for warning, notify and information when no Screen is present.
Claus Gittinger <cg@exept.de>
parents: 5062
diff changeset
  8228
        ex proceed.
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  8229
     ] do:[
5081
7e8bd5012897 care for warning, notify and information when no Screen is present.
Claus Gittinger <cg@exept.de>
parents: 5062
diff changeset
  8230
        'hello' printNL.
7e8bd5012897 care for warning, notify and information when no Screen is present.
Claus Gittinger <cg@exept.de>
parents: 5062
diff changeset
  8231
        self warn:'some info'.
7e8bd5012897 care for warning, notify and information when no Screen is present.
Claus Gittinger <cg@exept.de>
parents: 5062
diff changeset
  8232
        'world' printNL.
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  8233
     ]
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  8234
    "
1417
59e7d3c1df6d showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1397
diff changeset
  8235
1425
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  8236
    "Modified: 20.5.1996 / 10:28:53 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  8237
! !
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  8238
1788
0c71ba975d34 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1780
diff changeset
  8239
!Object class methodsFor:'documentation'!
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  8240
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  8241
version
5706
9c49e9b54c45 added AbortAllSignal
Claus Gittinger <cg@exept.de>
parents: 5686
diff changeset
  8242
    ^ '$Header: /cvs/stx/stx/libbasic/Object.st,v 1.349 2000-11-14 17:46:01 cg Exp $'
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  8243
! !
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  8244
Object initialize!